Saturday, October 4, 2014

ImageButton PostbackUrl not working (DoPostBackWithOptions)

This is a common problem.

I copied over a working code from my old project into this new project and it stopped working.

No postbacks occuring. When I did view source, the source for the old page (working) and the new page (not working) were exactly the same for these controls.

The image button uses DoPostBackWithOptions

So I started looking for help related to DoPostBackWithOptions.

Finally figured out. The issue being multiple instances of "FORM" being created.

If you have more than one forms on the page, ASP.NET does not know which one to post to and stays on the safer side by not posting to any ( :) )

Remove all but one form tags from your page and it will start working.