views:

106

answers:

1

I have a DataGrid which i am using on the page alogn with 4 tabs. Clicking on each tab different datasource is getting bing to the data grid. Now following is problem,

  1. There are 4 tabs of UI
  2. I have written code to bind data source to data grid on onclick event of tab (which is linkbutton)
  3. However when i am clicking on the tab data gets bind to data grid but item created and item databound event which i have attached to grid on page init() are not firing on the first time.
  4. I also have attached page index changed event clicking on which executes item created and item data bound event

Have anyone seen something like this before ? What could be the possible reasons ?

Thank all

A: 

Is the DataGrid being added to the page dynamically when the tab is activated? It sounds like it could be a problem with dynamically added controls and events, but additional details would really be helpful. It could also be the order in which things are happening in your page. Can you show the relevant code?

rchern
thanks for response, i just figured it out and it turned out to be my misunderstanding about view state. I have 4 tabs say A B C D. I was setting current tab value in view state on click event of A then creating and binding the data source to the grid. But by mistake i added value in wrong place so i was getting null on first click on A, then clicking on B gives A and so on. When i was clicking twice on the button it was working nicely. So tracing helped me. Thanks again for respones :)
Anil Namde