You only have to bind once during pageLoad. I think this code block executes on every Postback in your current code, so this might be rebinding your data tables. You can check by placing a break point on pageload in debug mode (This will be called on every postback). This might solve your problem
protected void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostback)
{
dtEquipment = new dsData.tblEquipmentDataTable();
taEquipment = new dsDataTableAdapters.tblEquipmentTableAdapter();
dsEquipment = new SqlDataSource();
smEquipment.RegisterAsyncPostBackControl(butUsers);
}
}
Edit
What I can understand from your code is that you were initializing data tables & table adapters on pageLoad
. Now after, we have put the initialization code inside if(!Page.IsPostBack)
you would get null references because they are not yet initialized (They were initialized on PageLoad event).
Remember HTTP is stateless
. To save state of these tables on each postback, you can either use Viewstate or Session.