Accesing control value in GridView on postback
-
I've a user control, which contains GridView. The gridview is bound to the ObjectDataSource. The gridview is displaying checkboxes in the shape of matrix like below
Title
View
Insert
Edit
Users
checkbox
checkbox
checkbox
Page Data
checkbox
checkbox
checkbox
The columns and Titles are dynamic, which is generated by the object(which is used by ObjectDataSource). The data of the grid is displayed correctly without any problem. Under the grid there is button. On the button click I want to know, which check boxes are checked. I can loop through every row of the grid and can access the checkbox also. Now, problem is, on button click when I am looping through gridview rows, all checkboxes are shown as unchecked while before click I check some checkboxes. Strange behavior is this, that, on 1st click, checkboxes are not retaining checked state, while on 2nd click, same code shows checked check boxes correctly. In short, problem is on 1st click, while subsequent clicks are working as expected. Is there anybody who can tell whats wrong?
Regards Aftab Sindhi .NET Application Developer U.A.E
-
I've a user control, which contains GridView. The gridview is bound to the ObjectDataSource. The gridview is displaying checkboxes in the shape of matrix like below
Title
View
Insert
Edit
Users
checkbox
checkbox
checkbox
Page Data
checkbox
checkbox
checkbox
The columns and Titles are dynamic, which is generated by the object(which is used by ObjectDataSource). The data of the grid is displayed correctly without any problem. Under the grid there is button. On the button click I want to know, which check boxes are checked. I can loop through every row of the grid and can access the checkbox also. Now, problem is, on button click when I am looping through gridview rows, all checkboxes are shown as unchecked while before click I check some checkboxes. Strange behavior is this, that, on 1st click, checkboxes are not retaining checked state, while on 2nd click, same code shows checked check boxes correctly. In short, problem is on 1st click, while subsequent clicks are working as expected. Is there anybody who can tell whats wrong?
Regards Aftab Sindhi .NET Application Developer U.A.E
Aftab Sindhi wrote:
In short, problem is on 1st click, while subsequent clicks are working as expected.
Just Debug the code.
Everything Is Possible!