
09-13-03, 06:05 AM
|
|
Newbie Coder
|
|
Join Date: Jul 2003
Location: Sweden
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Submit form in asp.net
I have these two .aspx pages, default.aspx and answer.aspx.
In the first, I have a form with a dropdown list, and a submit button. What I want is to submit the form to answer.aspx by clicking on the button. Could someone give me some help on this?
PLEASE HELP. Itīs probably really simple, but I donīt hace a clue how.
|

09-13-03, 01:32 PM
|
 |
Wannabe Coder
|
|
Join Date: Jul 2003
Posts: 136
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
<FORM METHOD=POST ACTION=URL>
__________________
God save us from the religious fanatics
|

09-13-03, 06:32 PM
|
|
Newbie Coder
|
|
Join Date: Jul 2003
Location: Sweden
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Then what?
This I have done, but it doesnīt work? what else is needed?
|

09-14-03, 12:06 AM
|
|
Coding Addict
|
|
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
on the other next page put Request.Form("TAG_NAME").
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
|

11-14-03, 10:44 AM
|
|
New Member
|
|
Join Date: Nov 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
This is ASP, not ASP.NET
Hello,
I am just looking for exactly same information, which is how to pass the value to the next page.
<form method=["post" or "get"] action=URL>
According to my research, couple of pages said that action works only for ASP, and not for ASP.NET. Therefore, even you type this line, browser will ignore the command.
<[@o@]> Here is a code behind code, which ask user to key in their name, and
when the button is pressed, it display the value. However, I want to
retrieve the value in another page. But I couldn't find the example.
All the examples I could find so far is same type of code as below,
using only one page.
Can any body help me with this?
Thanks in advance.
FileName: cb1.aspx
<%@ Page Language="cs" Src="cb1.cs" Inherits="HelloWebFormCs"%>
<HTML>
<HEAD>
<title>C# ASP.NET application with "Code Behind"</title>
</HEAD>
<body>
C# ASP.NET application with "Code Behind"<P />
<form runat="server" ID="Form1">
<asp:textbox id="fld1" runat="server" />
<asp:button runat="server" text="Say Hello" ID="Button1" /><br />
<asp:label runat="server" text="" id="TheLabel" />
</form>
</body>
</HTML>
FileName: cb1.cs
public class HelloWebFormCs : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox fld1;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Label TheLabel;
override protected void OnInit(System.EventArgs e)
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
base.OnInit(e);
}
private void Button1_Click(object sender, System.EventArgs e)
{
TheLabel.Text = "Hello, " + fld1.Text + "(from an ASP.NET/C# WebForm with code behind)";
}
}
|

11-14-03, 06:59 PM
|
|
New Member
|
|
Join Date: Nov 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
Pass submitted Values
First off, make friends with MSDN.
You can apporoach this at least two ways...
The First (probably easiest) providing a variable is being passed in the url like http://localhost/nextpage.aspx?fld=myvar:
The Second is to make use of properties:
formpage.cs
datapage.cs
It would probably benefit you to download the MSDN Library. Hope I've been helpful.
Quote:
|
Originally Posted by lunatchi
Hello,
I am just looking for exactly same information, which is how to pass the value to the next page.
<form method=["post" or "get"] action=URL>
According to my research, couple of pages said that action works only for ASP, and not for ASP.NET. Therefore, even you type this line, browser will ignore the command.
...
|
|

11-14-03, 10:07 PM
|
|
New Member
|
|
Join Date: Nov 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I made an error in my code above...
Instead of this:
It should say:
|

11-18-03, 05:13 AM
|
|
New Member
|
|
Join Date: Nov 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
Thanks
Your code gave me some idea of where I have been struggling.
Now, I can pass the value to other page, and retrieve them in the different page.
Thank you very very much!!
|

11-18-03, 07:33 AM
|
|
New Member
|
|
Join Date: Nov 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
To andreasberglind
I think this page gives you some idea about ASP.NET, which describes the differences of ASP and ASP.NET.
First of all, I also used to think in the same way that I can retrieve the data in the same manner as ASP. However, as this page describes that ASP.NET page never accept action even it has been defined as ASP.NET doesn't pass the value to another page. Therefore, always the value obtained in the page have to be processed within the same page... If my understanding is not wrong...
Anyway, I think, this is the page, which answers your questions.
http://www.wimdows.net/articles/article.aspx?aid=8
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|