Monday, March 26, 2012

Prevent CHECKBOX in Update Panel

Hi there,i'm using CHECKBOX in Gridview Template Panel, and My Gridview is under UpdatePanel. The update panel will be refresh every 3 second using timer. how to prevent CHECKBOX from 'unchecking' when the user have already check the CHECKBOX ?Thanks.

Hi,

can you identify if it is due to slowly loading update panel or checkbox just loses its checked state on postback?

You can place just a button anywher eon the page (disable your timer before) and see if checkbox loses its checked value when you click this button.

-yuriy


The CHECKBOX just loses its checked state. I dont think palce a button anywhere is the solution for the application, since it'll have so much button. any ideas ?Thanks.

Hi,

an approach would be saving the checked boxes in an hidden field in the page. When a postback occurs, you parse the hidden field and extract the info about the checked boxes.

Since the GridView might be bound to different data each time, you have to associate an ID to each checkbox. The ID might be that of a database row, for example.

Then, when you're binding the GridView, you check whether the ID is in the list of checked boxes. If it is, you select the corresponding checkbox.

Sounds little complicated, but it should work.

No comments:

Post a Comment