Issue on closing dialog page after multiple postbacks on the dialog page

Issue on closing dialog page after multiple postbacks on the dialog page

I have Page1 in which Page2 is called as dialog. Something like this-

<a href="/Page2.aspx" data-rel="dialog"  data-transition="slideup">Open dialog</a>

In page2, actions are performed as I have gridview operations like edit/ delete and other asp button operations. The postback events work fine. The issue is when I have more than one postback event in the dialog page, the close dialog button do not close.

FYI... On each postback event on dialog (page2), the url is appended with "#&ui-state=dialog". So if there are 10 postback events, there would be 10 times of "#&ui-state=dialog" appended to the url. I have to click 9 times to clear each of it and last click do not work and eventually do not close the dialog. Is there a way to close the dialog in just one click?

Thanks in Advance