Posting in asp.net
-
Hi! I have a login control (LogIn.asmx) and a search control (Search.asmx). When typing in the search control and pressing return the whole page is posted to the server. My login control is looking for IsPost back but still it tries to log me in?! How should I do to prevent this behaviour? How can I make the page respond to the "correct" submitevent? Thnx!
-
Hi! I have a login control (LogIn.asmx) and a search control (Search.asmx). When typing in the search control and pressing return the whole page is posted to the server. My login control is looking for IsPost back but still it tries to log me in?! How should I do to prevent this behaviour? How can I make the page respond to the "correct" submitevent? Thnx!
As far as I can understand, you have two usercontrols inside a server side form. so when you are pressing enter into search control, the postback fires and hence gives problem to your login control. The solution is that you keep the two controls in two different forms in the page. Since there can't be two server side forms, so one of your forms have to be an ordinary html form, and you have to deal with that usercontrol in the classic ASP style. Thanks
Pradipta Basu
-
Hi! I have a login control (LogIn.asmx) and a search control (Search.asmx). When typing in the search control and pressing return the whole page is posted to the server. My login control is looking for IsPost back but still it tries to log me in?! How should I do to prevent this behaviour? How can I make the page respond to the "correct" submitevent? Thnx!
The problem is, when you press Enter key from the Search control, its triggering Login Control's submit click... This is because Login Control has the Default Action Command. To solve this problem, use javascript in onkeycode event of each TextBox control in your UserControl and trigger the Submit action when Enter key is pressed.
Regards, Venkatesh Mookkan. Software Engineer, India My: Website | Yahoo Group