Wednesday, November 4, 2009

PostBack in ASP.Net showModalDialog opens a new window

When working with Modal Dialog Windows in ASP.Net you have experience that postback opens up a new window. This behavior is by default.

I was using window.showModalDialog() to open a ASPX Page from the parent page using JavaScript. But whenever the postback happens in the modal window during a button click or dropdown value changes, it would spawn off a new window.

You can change the behaviour by just including below tag line in the <head> of the modal window (that is aspx page).
<base target="_self">

I hope this would help you resolving the problem.

1 comment:

TravelOnnn said...

Thanks this is something i was looking for. It helped.