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.
Categories: Programming
.net 3.5, c#, CommandName, GridView, OnRowCommand
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.
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.