DataGrid TemplateColumn ViewState
-
Me again :) In a web application I'm writing I have a datagrid with template columns that I use for filtering of another datagrid. What i do is add 1 row to the template columns datagrid and load appropriate controls (textboxes,dropdownlists,etc.) to give the user the option to enter values. It works fine, the filtering is done, but the thing is that after postback all the selected values of the columns disappear - textboxes become blank, etc. What can I do to keep the viewstate? ViewState is enabled for both the controls and the datagrid.
-
Me again :) In a web application I'm writing I have a datagrid with template columns that I use for filtering of another datagrid. What i do is add 1 row to the template columns datagrid and load appropriate controls (textboxes,dropdownlists,etc.) to give the user the option to enter values. It works fine, the filtering is done, but the thing is that after postback all the selected values of the columns disappear - textboxes become blank, etc. What can I do to keep the viewstate? ViewState is enabled for both the controls and the datagrid.
When you are adding the controls? You have to do it during ItemCreated event of the Datagrid. Then it will work. I dont know why.
-
When you are adding the controls? You have to do it during ItemCreated event of the Datagrid. Then it will work. I dont know why.
No, the controls are static. I am not adding anything programmatically.
-
No, the controls are static. I am not adding anything programmatically.
Can you post the code so that I can try.
-
Me again :) In a web application I'm writing I have a datagrid with template columns that I use for filtering of another datagrid. What i do is add 1 row to the template columns datagrid and load appropriate controls (textboxes,dropdownlists,etc.) to give the user the option to enter values. It works fine, the filtering is done, but the thing is that after postback all the selected values of the columns disappear - textboxes become blank, etc. What can I do to keep the viewstate? ViewState is enabled for both the controls and the datagrid.
When exactly r u adding data to controls...! Adding data shld not be static i guess. Utsav
-
When exactly r u adding data to controls...! Adding data shld not be static i guess. Utsav
maybe i didn't make this clear... I am NOT adding data, except for one place, and anyway the data stays there. My problem is that if say I have a dropdown list and i choose a value and then hit a button that analyzes what i chose in that dropdown ==> the operation does happen, i.e. the data remains there "enough time" after postback, but the dropdown list itself gets reset: The value I chose is not the selected one anymore. Hope it is clearer now.
-
maybe i didn't make this clear... I am NOT adding data, except for one place, and anyway the data stays there. My problem is that if say I have a dropdown list and i choose a value and then hit a button that analyzes what i chose in that dropdown ==> the operation does happen, i.e. the data remains there "enough time" after postback, but the dropdown list itself gets reset: The value I chose is not the selected one anymore. Hope it is clearer now.
Well well well, unfortunately u r rite, i tried it n find the same thing, let me wait 4 some correct solution of ur problem, it'd help me too now Utsav