Home > Programming > Break out of WebForm_DoPostBackWithOptions Hell

Break out of WebForm_DoPostBackWithOptions Hell


I have been going nuts all day trying to get a link button to fire its command event and cause a postback in a GridView control.  On this particular page, whenever I click on the link, I get a WebForm_DoPostBackWithOptions instead of __doPostback, and of course I never hit the grid’s command event in my page behind.

The solution?  Set causesvalidation=”false” in the link button and the command event will fire.   Why, I don’t know, this just works and hopefully you’ll find this post before having to spend too many hours trying to figure it out.

  1. I. Hsu
    February 25, 2013 at 2:33 pm

    Figured this one out… you have validation controls with Display=”Dynamic”, causing all of your postback-triggering controls to not fire unless the input on your page is valid. Add in a ValidationGroup to only the controls you want to vaildate, as well as the button that causes the validation, then you don’t have to use the causesvalidation=”false” hack.

    • February 25, 2013 at 4:18 pm

      This is a very interesting reply, thank you. It’s been a while since I last worked on that page, but I will certainly review it with your answer in mind. Thank you again.

  1. No trackbacks yet.

Leave a comment