Access MasterPage

I’d searched the web a while back and I didn’t found an answer to my curiosity. I am using a master page, and I have this content page, in which I have to store the entry on another content page. If I am not using a master page, then, I can simply specify on the form’s action attribute the file name of the page where am I going to store my entry. Can anyone, help me.

I’m not understanding what the question is.

If I am not using a masterpage then, I can simply write this on page


<form method="post" runat="server" action="saveentry.aspx">
</form>

Since, I am using a Master Page, how can I point to saveentry.aspx to store the inputted data on the database?

Use this on the masterpage

<form id="surround" runat="server">

and the content pages will post to themselves.

Yeah, that is what I’m doing right now. But what I’m trying to do is to store the inputted data on page into another content page and not with the current content page. That is why if I am not using a master page then, I can simple write this line

<form method="post" runat="server" action="saveentry.aspx">

This will simply store the inputted data into my database through saveentry.aspx.

I think there’s a way to do it but I’ve never come across a good reason to use it.

Well, all I want to do is to post my form’s data from another page. But then, I am using a Master Page.

After a spending lots of time surfing the web, I found a solution. I have to set the PostBackUrl property of the submit button. Thanks imaginekitty for your time.

With ASP.Net 3.5 SP1 you can use: Form1.Action = “someOtherPage.aspx”;

I posted that before, but then I tried it and it didn’t work as expected so I deleted the post. Is it working for you properly?

Well, it seems that it doesn’t work properly because there’s an exception error in my page like App_Web_g4ssllt2.

Here with some code to find the form on the master page:


// Form Action
System.Web.UI.HtmlControls.HtmlForm form = (System.Web.UI.HtmlControls.HtmlForm)Master.FindControl("Form1");
if (form != null)
{
	form.Action = "saveentry.aspx";
}