473,419 Members | 1,679 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,419 software developers and data experts.

Action on a form in Dot Net


I am a newbie to ASP.NET. I am converting some asp pages I had working.
I have a page which has a form with several input elements. When the
user clicks on a Submit element - the action specified in the form tags
is to post the data to a new page. What happens however is that the
original page simply reloads. How do I force it to post to the new page
instead. (I suspect the problem may be the runat server directive? I
had to use that to populate my dropdowns with databinding)

Here is the form declaration:

<form method="post" name="churchform" id="churchform"
action="localstuffPostData.aspx"
runat="server">


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #1
3 2178
I have not tried this, but you might want to take a look:
http://www.codeproject.com/aspnet/jsnopostback.asp

"Don Parker" <sc*************@yahoo.com> wrote in message
news:#P**************@TK2MSFTNGP09.phx.gbl...

I am a newbie to ASP.NET. I am converting some asp pages I had working.
I have a page which has a form with several input elements. When the
user clicks on a Submit element - the action specified in the form tags
is to post the data to a new page. What happens however is that the
original page simply reloads. How do I force it to post to the new page
instead. (I suspect the problem may be the runat server directive? I
had to use that to populate my dropdowns with databinding)

Here is the form declaration:

<form method="post" name="churchform" id="churchform"
action="localstuffPostData.aspx"
runat="server">


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #2
In ASP.NET 2.0 changing the form action will be easy. However, setting the
form action attribute just isn't the ASP.NET 1.x way. If you must do it
precisely that way the you can change the action attribute using client side
script or you can define a form without the runat=server attribute (in which
case it will act a whole lot like classic ASP.)

Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/is...e/default.aspx

http://www.aspalliance.com/kenc/passval.aspx

http://www.dotnetbips.com/displayarticle.aspx?id=79

Here's one nice, simple way to pass values from one page to another:

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")

Then, in WebForm2.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Don Parker" <sc*************@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...

I am a newbie to ASP.NET. I am converting some asp pages I had working.
I have a page which has a form with several input elements. When the
user clicks on a Submit element - the action specified in the form tags
is to post the data to a new page. What happens however is that the
original page simply reloads. How do I force it to post to the new page
instead. (I suspect the problem may be the runat server directive? I
had to use that to populate my dropdowns with databinding)

Here is the form declaration:

<form method="post" name="churchform" id="churchform"
action="localstuffPostData.aspx"
runat="server">


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 19 '05 #3

Thanks for the great information! I guess the easiest thing to do is
just postback to the original page. I always liked to keep them
separate for clarification in the past with ASP but with code behind now
- I guess that situation is not a big deal. Thanks again. I'm afraid
I'm trying to write ASP code in ASP.NET.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #4

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

Similar topics

19
by: Pete | last post by:
I have form/select which executes a function using onchange. No problem. However, when I validate the page with a strict HTML 4.01 doctype at http://validator.w3.org, it demands either an action or...
7
by: TJS | last post by:
what is wrong here, the submit will only post page back to itself instead of specifed action <SCRIPT language="Javascript"> function Submit_Form(){ document.Form1.Action="cart.asp";...
5
by: bissatch | last post by:
Hi, I have been trying to come up with an idea to reduce double submissions where a user clicks refresh and, for example, another row is INSERT into a table. Originally, I would have a form...
10
by: iam247 | last post by:
Hi In my prototype asp page (with no javascript and no password validation, I have a registration form with the following action: <form name="form" method="post" action="RegDetails.asp"> ...
2
by: iam247 | last post by:
Hi In my prototype asp page (with no javascript and no password validation, I have a registration form with the following action: <form name="form" method="post" action="RegDetails.asp"> ...
6
by: tencip | last post by:
Hi everyone, So, i've got a form that is very simple. It hold three elements: username, password, and domain. The goal here is to have the form submit the login to an administrative section...
1
by: rdemyan via AccessMonster.com | last post by:
My application is mostly about performing analyses on data: looking for errors/problems/potential savings, etc. I would like to create a form where a user can create action items for themselves,...
3
by: shanmukhi | last post by:
hi all, i got a problem with struts. iam unable to find it. i have written an action class, form bean class and a jsp page on submitting form, request is going to action class but it is not...
6
by: Arthur | last post by:
Hello. How might it be possible to change where a form action is directed based on a selected option. For example I have this: <FORM METHOD = "post" ACTION = ""> And a drop down such as
9
by: Meendar | last post by:
Hi, Below is my code snippet having only one form, <form> <input type ="radio" name="action" value="xyz" checked>xyz <input type ="radio" name="action" value="zyx">zyx <input type ="radio"...
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.