| |

VerySource

 Forgot password?
 Register
Search
View: 789|Reply: 3

Ask Request.Form again

[Copy link]

2

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-23 22:30:01
| Show all posts |Read mode
1. <body>
    <form id = "form1" runat = "server">
    <div>
        <asp: Label ID = "Label1" runat = "server" Text = "Your name is:"> </ asp: Label>
        <asp: TextBox ID = "name" runat = "server"> </ asp: TextBox> <br />
        <asp: Label ID = "Label2" runat = "server" Text = "Your age is:"> </ asp: Label>
        <asp: TextBox ID = "age" runat = "server"> </ asp: TextBox> <br />
        <asp: Button ID = "Button1" runat = "server" Text = "Submit" OnClick = "Button1_Click" />
        <br />
        <br />
        <br />
    </ div>
    </ form>
</ body>

protected void Button1_Click (object sender, EventArgs e)
    {
        // Method for passing multiple data from one web page to another web page
        //Response.Redirect("get.aspx?id= "+ name.Text +"&age = "+ age.Text);
        Response.Redirect ("get.aspx");
        
    }


2,
 protected void Page_Load (object sender, EventArgs e)
    {
        string recive_id, recive_age;
        recive_id = Request.Form ["id"];
        recive_age = Request.Form ["age"];
        Response.Write ("My name =" + recive_id + "<br/>" + "My age =" + recive_age + "<br/>");
        // 3\
        Response.Write ("You are using" + Request.RequestType + "Method to pass data");
        
    }

How can I get their value? Please master point me. I have already posted this post before, but I still can't pass it on. Is it because the method I wrote in the Button1_Click event is wrong? Please master
Reply

Use magic Report

0

Threads

17

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

Post time: 2020-5-10 08:15:01
| Show all posts
protected void Page_Load (object sender, EventArgs e)
    {
        string recive_id, recive_age;
        recive_id = Request.Form ["name"]. ToString ();
        recive_age = Request.Form ["age"]. ToString ();
        Response.Write ("My name =" + recive_id + "<br/>" + "My age =" + recive_age + "<br/>");
        // 3\
        Response.Write ("You are using" + Request.RequestType + "Method to pass data");
        
    }
Reply

Use magic Report

0

Threads

11

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-5-10 13:00:01
| Show all posts
recive_id = Request.QueryString ["name"]. ToString ();
recive_age = Request.QueryString ["age"]. ToString ();
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-1 21:45:01
| Show all posts
If you must use the Redirect method, you can only use the Get method to pass the value, just like the sentence you commented.
//Response.Redirect( "get.aspx?id = "+ name.Text + "&age =" + age.Text);

If you don't want to use this method, use this method instead.
Server.Transfer("******.aspx");
Value method such as: Request["****"].ToString();
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list