Sitecore with Gridview – rowupdating event doesn’t fire

Whenever using Databound server controls with Sitecore need to be aware that Sitecore  meddles with some controls. This nasty issue which can have you banging your head against the wall for hours (days?) has been previously blogged by Mark Cassidy but I guess it depends on what symptom you’re having first, and wether you relate it back to this obscure setting. In my case, I was previously aware of this issue but only relating to apparent loss of viewstate on controls. Unfortunately I didn’t think of it as affecting events too.

In my case most features worked, Edit buttons would invoke row editing mode, cancel button works fine, rowCommand event generally worked, but it wasRowUpdating that simply wasn’t working. Adding System.Web.UI.WebControls.GridView to <typesThatShouldNotBeExpanded> in web.config resolves this issue. your web.config would then look like :

<typesThatShouldNotBeExpanded>
<
type>System.Web.UI.WebControls.Repeater</type>
<
type>System.Web.UI.WebControls.GridView</type>
<
type>System.Web.UI.WebControls.DataList</type>
</
typesThatShouldNotBeExpanded>

This issue does now have a fleeting mention on http://sdn.sitecore.net/Scrapbook….. but requires login to view it.

While looking for that link, I also came across another blog post detailing the same issue and frustrations I’ve had with Gridview events that may have more detail.

3 thoughts on “Sitecore with Gridview – rowupdating event doesn’t fire

  1. aDev

    Hi…

    thanks very much for this info.. from almost 3 hours I am fighting with this error and now your solution works.

    thanks again

    Reply
  2. Karsten

    I love you dude. I’ve been fighting with this problem for almost a day now, before I thought it might be a Sitecore problem and not asp.net.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *