introduction I had encountered recently that Response.Redirect is not working on a button click. I searched all the net articles.. which dint give me a clue. but luckily, I have found out the solution to my problem. Likes to share hope it may helps
Scenario> I have a A.aspx page, one button 'Back', and another 'Save' buttons. 'Save' has some functionality, which is written in Server side event Save_Click(...) Back should also have same functionality, but after the functionality done...it should go to B.aspx page. Both buttons are of submit kind of buttons.
First on client side, I have 'Save' functionality, for 'Back', I just set a hidden variable to maintain to set that its for back.. and simulated btnSave.click() on the javascript in Back_ClientClick() event. On the server side, I check that hidden variable, if its from back, I wrote Response.Redirect('B.aspx' false). PROBLEM: Response.Redirect was not going to B.aspx page..stays only at A.aspx. OBSERVATIONThe back button after simulating save.click(), as it is a submit kind of button, it is posting again to the server..so we need to nullify double posting..(one by save.click and another back button usual submit behavior).. so in the Back_ClientClick() function after save.click() event, called return false, to nullify double submit. GIST: If the Response.Redirect is not working, just check any button click is posting more than once..!!
Hope it helps...
|
| Author: Vijay 03 Oct 2004 | Member Level: Bronze Points : 0 |
Yes!! I am facing same problem. but I cannot understand what is the solution. Does this article says that if we use 2 forms in a page we will get this type of error ? But I am using only one form but I am facing this problem. I would be very thankfull if you give me clear solution.
Vijay
|