CRM 4.0 asp.net postbacks and viewstate
Posted by Bert-Jan Diedering in ASP.NET, C#, CRM, tags: ASP.NET, crm 4.0, viewstate, visual studio 2005, visual studio 2008A little while ago, I was having trouble with postbacks and databound dropdownlists in a custom ASP.NET applicaion for CRM 4.0. After struggling for a day and sticking my head in the sand for a month, I picked up the problem for the last time. I was going to nail this sucker!
Going back to basics and suddenly I started thinking : But what was the solution?
Viewstate in ASP.NET! So after some digging, some google I found my hero : Gustaf Westerlund.
Add this line to your web.config of your custom ASP.NET application for CRM 4.0 and you are done :
<pages enableViewState="true" />
Shame on me for not seeing that in an earlier stage!
The viewstate in your web.config in the root of your CRM installation is set to false. That means that every site “beneath” that root level is taking over this viewstate setting… To false! So basically… Viewstate is evil! ASP.NET is scary!
Ow…yeah… and don’t forget to enable this property for your databound controls :
AppendDataBoundItems="True"
Dit lost dus voor mij een berg problemen met databinding en postbacks op, misschien heeft die ene trouwe lezer van mijn blog er wat aan?
This is solving a lot of databinding and postback problems! Maybe I’m helping that one reader of my blog with this?
PS: Gustaf, thank you very much!


Entries (RSS)