Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   How do I get a form to post to another page when runat="server" is true? (http://www.velocityreviews.com/forums/t107154-how-do-i-get-a-form-to-post-to-another-page-when-runat-server-is-true.html)

COHENMARVIN 07-28-2005 03:00 PM

How do I get a form to post to another page when runat="server" is true?
 
I'm a asp programmer starting out with asp.net. I understand that an
asp form can post to its own page and that this allows validation of
form fields on the server. But suppose all the controls turn out to be
valid, and now I want to move to a new page?
My form declaration looks like this:
<form METHOD="POST" ACTION="sites2.aspx" name="MyForm" runat="server">
This form declaration is on a page called sites1.aspx, but it doesn't
post any data to sites2.aspx. In fact, "sites2.aspx" doesn't show up
at all, instead I keep getting sites1.aspx every time I click on the
SUBMIT button.
What am I doing wrong?
Thanks,
CohenMarvin


Marina 07-28-2005 03:05 PM

Re: How do I get a form to post to another page when runat="server" is true?
 
But if the validation is happening on the server, that means the page has
already posted back to itself. So the Action was pointing to the current
page.

I dont' really understand what you are trying to do here.

I would recommend you throw out 95% of the techniques you used to get things
done in ASP. They will typically only lead you down the wrong path.

Your page should validate its own data, and process it. Once it is done, it
should redirect to the next logical page in your application. This page
should follow the same model. Every page is typically self contained - it
does not need the help of any other page to do its processing.

Hope that helps.

"COHENMARVIN" <cohenmarvin@hotmail.com> wrote in message
news:1122562801.604178.195140@g43g2000cwa.googlegr oups.com...
> I'm a asp programmer starting out with asp.net. I understand that an
> asp form can post to its own page and that this allows validation of
> form fields on the server. But suppose all the controls turn out to be
> valid, and now I want to move to a new page?
> My form declaration looks like this:
> <form METHOD="POST" ACTION="sites2.aspx" name="MyForm" runat="server">
> This form declaration is on a page called sites1.aspx, but it doesn't
> post any data to sites2.aspx. In fact, "sites2.aspx" doesn't show up
> at all, instead I keep getting sites1.aspx every time I click on the
> SUBMIT button.
> What am I doing wrong?
> Thanks,
> CohenMarvin
>




=?Utf-8?B?QnJpYW4gRg==?= 07-28-2005 06:19 PM

Re: How do I get a form to post to another page when runat="server
 
SO true... in the page_load event you should use the If logic as follows

If Not IsPostback then
load page for the first time
else
validate process
SERVER.TRANSFER("page2.aspx")
end if



"Marina" wrote:

> But if the validation is happening on the server, that means the page has
> already posted back to itself. So the Action was pointing to the current
> page.
>
> I dont' really understand what you are trying to do here.
>
> I would recommend you throw out 95% of the techniques you used to get things
> done in ASP. They will typically only lead you down the wrong path.
>
> Your page should validate its own data, and process it. Once it is done, it
> should redirect to the next logical page in your application. This page
> should follow the same model. Every page is typically self contained - it
> does not need the help of any other page to do its processing.
>
> Hope that helps.
>
> "COHENMARVIN" <cohenmarvin@hotmail.com> wrote in message
> news:1122562801.604178.195140@g43g2000cwa.googlegr oups.com...
> > I'm a asp programmer starting out with asp.net. I understand that an
> > asp form can post to its own page and that this allows validation of
> > form fields on the server. But suppose all the controls turn out to be
> > valid, and now I want to move to a new page?
> > My form declaration looks like this:
> > <form METHOD="POST" ACTION="sites2.aspx" name="MyForm" runat="server">
> > This form declaration is on a page called sites1.aspx, but it doesn't
> > post any data to sites2.aspx. In fact, "sites2.aspx" doesn't show up
> > at all, instead I keep getting sites1.aspx every time I click on the
> > SUBMIT button.
> > What am I doing wrong?
> > Thanks,
> > CohenMarvin
> >

>
>
>


Marina 07-28-2005 06:41 PM

Re: How do I get a form to post to another page when runat="server
 
Or more typically, there is some sort of button click handler, or something
like that. So depending on what button go clicked or what not, the
processing may be a bit different.

But that's the general idea.

"Brian F" <BrianF@discussions.microsoft.com> wrote in message
news:7E36CB05-C694-4591-AB66-C7C5777746FC@microsoft.com...
> SO true... in the page_load event you should use the If logic as follows
>
> If Not IsPostback then
> load page for the first time
> else
> validate process
> SERVER.TRANSFER("page2.aspx")
> end if
>
>
>
> "Marina" wrote:
>
>> But if the validation is happening on the server, that means the page has
>> already posted back to itself. So the Action was pointing to the current
>> page.
>>
>> I dont' really understand what you are trying to do here.
>>
>> I would recommend you throw out 95% of the techniques you used to get
>> things
>> done in ASP. They will typically only lead you down the wrong path.
>>
>> Your page should validate its own data, and process it. Once it is done,
>> it
>> should redirect to the next logical page in your application. This page
>> should follow the same model. Every page is typically self contained -
>> it
>> does not need the help of any other page to do its processing.
>>
>> Hope that helps.
>>
>> "COHENMARVIN" <cohenmarvin@hotmail.com> wrote in message
>> news:1122562801.604178.195140@g43g2000cwa.googlegr oups.com...
>> > I'm a asp programmer starting out with asp.net. I understand that an
>> > asp form can post to its own page and that this allows validation of
>> > form fields on the server. But suppose all the controls turn out to be
>> > valid, and now I want to move to a new page?
>> > My form declaration looks like this:
>> > <form METHOD="POST" ACTION="sites2.aspx" name="MyForm" runat="server">
>> > This form declaration is on a page called sites1.aspx, but it doesn't
>> > post any data to sites2.aspx. In fact, "sites2.aspx" doesn't show up
>> > at all, instead I keep getting sites1.aspx every time I click on the
>> > SUBMIT button.
>> > What am I doing wrong?
>> > Thanks,
>> > CohenMarvin
>> >

>>
>>
>>




Scott Allen 07-28-2005 07:52 PM

Re: How do I get a form to post to another page when runat="server" is true?
 
There is no inherent support for cross page postbacks until v2.0 of
ASP.NET. See:

Design Considerations for Cross Page Post Backs in ASP.NET 2.0
http://odetocode.com/Articles/421.aspx

You can still use a couple techniques in the article to get to the
other page, including Response.Redirect and Server.Transfer.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 28 Jul 2005 08:00:01 -0700, "COHENMARVIN" <cohenmarvin@hotmail.com>
wrote:

>I'm a asp programmer starting out with asp.net. I understand that an
>asp form can post to its own page and that this allows validation of
>form fields on the server. But suppose all the controls turn out to be
>valid, and now I want to move to a new page?
>My form declaration looks like this:
><form METHOD="POST" ACTION="sites2.aspx" name="MyForm" runat="server">
>This form declaration is on a page called sites1.aspx, but it doesn't
>post any data to sites2.aspx. In fact, "sites2.aspx" doesn't show up
>at all, instead I keep getting sites1.aspx every time I click on the
>SUBMIT button.
>What am I doing wrong?
>Thanks,
>CohenMarvin




All times are GMT. The time now is 08:08 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.