Celtic Coding Solutions Blog

Celtic Coding Solutions Blog - for everything computer related

Asp.Net controls not keeping state on postback

Upgraded an Asp.Net project from Visual Studio 2013 to Visual Studio 2015 and then updated Telerik Controls from Version 2015.1.401.45 to 2015.2.826.45 and noticed none of my dropdowns, treeview controls where keeping state on postbacks.  I was binding data to these controls as per normal, but on postbacks they where losing state, so the dropdowns where empty and the chosen items where obviously not being kept.

Checked my Web.Config and I still had sessionstate active:-

<sessionState mode="InProc" cookieless="false" timeout="30" />

Fix:-

After much scratching of head I had another look at web.config and compared against a version in source control that was working and noticed this little gem:-

<pages enableViewState="false">

      <controls><add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" /></controls>

</pages>

So looks like the upgrade either with telerik or Visual Studio added:-

enableViewState="false"

After removing this my Asp.Net code worked again - phew!

Comments are closed