ASP.NET and jQuery - submitting forms from a modal box?
I have an ASP.NET web site with master/content pages. On the master page, there is a link to log-in and that brings up a modal jQu开发者_Python百科ery form. How can I make sure that the info that is submitted on this form (which is just a DIV in my master page) is handled by a particular postback event?
Keep in mind that the modal can be submitted from any number of pages and I want to make sure that when the modal is submitted, the postback event of the content page is ignored while the postback of the master page handles the form.
if you leave the postback address blank (in html) it will post to the same page. if you can't do this, try passing in a variable with the page's address.
You can't prevent your Content page from detecting that a postback has happened. The way MasterPages/Content Pages work is that the MasterPage is applied to the Content page after OnPreInit
at that point the MasterPage is accessibly from the Content page. However, if you define the button handler in your MasterPage
<asp:Button ... OnClick='myHandler'>
you can do any processing from within the MasterPage's code-behind.
protected void myHandler(object sender, EventArgs e)
{...handle button click...}
But, that handler will be triggered after the Content page and Master Page has fired all events before the OnLoadComplete()
page method
精彩评论