Last post Jan 08, 2015 05:49 AM by AidyF
Jan 08, 2015 05:23 AM|jameerasp.net|LINK
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.
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.
Jan 08, 2015 05:38 AM|jameerasp.net|LINK
I kept EnableViewState=false in page level and
EnableViewState=true in ddl then also unable to bind ddl values after post back
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;
<%@ Page EnableViewState="true" ViewStateMode="Disabled" ... %>
and for the control you want to enable viewstate on
<asp:DropDownList ID="ddl" runat="server" ViewStateMode="Enabled"></asp:DropDownList>