Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
95
Regarding maintaining viewstate of checkbox in ultrawebgrid
posted

Hi,

I am having an ultrawebgrid which will refresh after every 30 seconds using the ajax update panel and timer. The first column is a checkbox template column. I need to maintain the state of the checkboxes when the ultrawebgrid refreshes. I had set the EnableViewState property of the checkbox as true but it doesnt seem to work.

 Please help.

  • 45049
    Suggested Answer
    posted

    You have to do some additional coding to have any controls inside a WebGrid templated column be tracked in ViewState.  This is one of the topics covered in the following article from our online Knowledge Base:
    HOWTO: Advanced Dynamic Templated Column

    In particular, download the "2005v1" sample for your desired programming language, and look for a section of commented-out code.  This shows what to do and provides some detail about how it works.

    Another solution is to use a column whose Type is set to CheckBox.  This is most easily accomplished by adding an unbound column whose data type is set to Boolean.  This will provide significantly better performance than using a templated column, and the column will be stored in ViewState in the same way as any other WebGrid column.  If you don't specifically need to use a tempalted column for some other reason, this is a better solution.