From form1 I m passing the values of two textboxes & on form 2 I m receiving it---
FORM1 CODE-

protected void Button1_Click(object sender, EventArgs e)
{

Response.Redirect("default4.aspx?roll="+TextBox1.Text);
Response.Redirect("default4.aspx?name="+TextBox2.Text);
}

FORM2 CODE--

protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = Request.QueryString["roll"].ToString();
Label2.Text = Request.QueryString["name"].ToString();
}

But the error is coming

Recommended Answers

All 5 Replies

Hi again Sonia. What is your error message?

Try removing the .ToString part of your Form 2 code like this :

FORM2 CODE--
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = Request.QueryString["roll"];
Label2.Text = Request.QueryString["name"];
}

I think this will help, let me know how you get on...

protected void Button1_Click(object sender, EventArgs e)
    {
        
       Response.Redirect("default4.aspx?roll="+TextBox1.Text);
        Response.Redirect("default4.aspx?name="+TextBox2.Text);
    }

FORM2 CODE--

protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = Request.QueryString["roll"];
        Label2.Text = Request.QueryString["name"];
    }

On Form2 Only the value of first textbox is displayed,value of second textbox is not displayed

Please use code tags, it looks very untidy without them, with regards to the 2nd label not showing have you sorted this yet?

The problem is that you are using 2 Response.Redirects. Use this code to append both values to the same Querystring: Response.Redirect("default4.aspx?roll="+TextBox1.Text + "&"+"name="+TextBox2.Text); Then retrieve the values in the Label as you have done.

Regards
Sunil Punjabi
<URL Snipped>

commented: Well spotted! +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.