473,385 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

Nov 19 '05 #1
4 1634
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" <co*********@hotmail.com> wrote in message
news:11**********************@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

Nov 19 '05 #2
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" <co*********@hotmail.com> wrote in message
news:11**********************@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


Nov 19 '05 #3
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" <Br****@discussions.microsoft.com> wrote in message
news:7E**********************************@microsof t.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" <co*********@hotmail.com> wrote in message
news:11**********************@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
>


Nov 19 '05 #4
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" <co*********@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


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Hai Nguyen | last post by:
Hi all I have a several User Controls which require this tag: "<form runat="server">. I tried to have all of these user user controls on the same web page. It kept giving me an error :""A page...
6
by: Martin Eyles | last post by:
Hi, I have a page that contains the following <div runat="server" id="Pikea"> <object runat="server" id="PiTV" style="width:560px; height:560px"...
3
by: Jaime Stuardo | last post by:
Hi all... Both controls are server side. The former has more properties. Both may have associated events that are ran at server. Which one are recommended to use? is performance an issue? in...
3
by: Jeff | last post by:
hey asp.net 2.0 If I have a plain html table in my asp.net 2.0 webpage, and later decide to add this property: runat="server" to the table. Does this turn the table into a asp.net table...
4
by: Kevin Blount | last post by:
bit long winded this one, so stick with me: I'm trying to create a form that can go to one of 3 places, depending on various elements. My form control looks like this: <form runat="server"...
1
by: mark4asp | last post by:
<form runat="server"automatically adds <divtag to code contained within. Is there a way to stop that? Mixing block-level elements with inline-level elements messes up the HTML becasuse that is...
2
by: Bob | last post by:
Hi, in aspx file, i defined this: <input id="Button2" type="button" value="button" runat="server" onclick="klik()"/> This 'onclick' event is a clientclick (starting the Javascript function...
4
by: Chris | last post by:
Hi, i 'm experimenting with postback and i tried that with a button server control and an Html input button but with runat="server". The button server control causes a postback, but not the...
19
by: Scott M. | last post by:
Why do we need runat="server" on our <headtags?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.