views:

28

answers:

2

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 jQuery 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.

A: 

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.

Scott M.
If it posts to the same page that means that the content page will pick it up - I need the master page to pick it up
Jim Beam
A: 

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

Pete Amundson
In Summary - In the ASP.Net Page LifeCycle the MasterPage and ContentPage are not independent and cannot be separated
Pete Amundson