In Asp.net page i have 3 ddl working fine but when i placed EnableViewState=false in page,ddl values are unable to find then i placed EnableViewState=true for all dddls,
even though ddls are unable to bind data after page pastback.
thanks in advance,if anyone has solution please update with solution.
If you want to disabled viewstate on a dropdown you need to repopulate the listitems on each page_load. Dropdowns are better left with their viewstate enabled.
If you have EnableViewState=false at the page level then that is a blanket setting, setting it to true on individual controls doesn't override this. If you want to disable the viewstate for the page but enable it on certain controls then you need to use
EnableViewState in conjunction with ViewStateMode. In your page directive;
Member
4 Points
50 Posts
dropdownlist values in enableviewstate=false
Jan 08, 2015 05:23 AM|jameerasp.net|LINK
Hi,
In Asp.net page i have 3 ddl working fine but when i placed EnableViewState=false in page,ddl values are unable to find then i placed EnableViewState=true for all dddls,
even though ddls are unable to bind data after page pastback.
thanks in advance,if anyone has solution please update with solution.
dropdownlistenableviewstatedropdownlistvaluespostback
All-Star
37441 Points
9076 Posts
Re: dropdownlist values in enableviewstate=false
Jan 08, 2015 05:32 AM|AidyF|LINK
If you want to disabled viewstate on a dropdown you need to repopulate the listitems on each page_load. Dropdowns are better left with their viewstate enabled.
dropdownlistenableviewstatedropdownlistvaluespostback
Member
4 Points
50 Posts
Re: dropdownlist values in enableviewstate=false
Jan 08, 2015 05:38 AM|jameerasp.net|LINK
Hi AidyF,
I kept EnableViewState=false in page level and
EnableViewState=true in ddl then also unable to bind ddl values after post back
dropdownlistenableviewstatedropdownlistvaluespostback
All-Star
37441 Points
9076 Posts
Re: dropdownlist values in enableviewstate=false
Jan 08, 2015 05:49 AM|AidyF|LINK
If you have EnableViewState=false at the page level then that is a blanket setting, setting it to true on individual controls doesn't override this. If you want to disable the viewstate for the page but enable it on certain controls then you need to use EnableViewState in conjunction with ViewStateMode. In your page directive;
and for the control you want to enable viewstate on
dropdownlistenableviewstatedropdownlistvaluespostback