0

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

3
Contributors
5
Replies
6
Views
8 Years
Discussion Span
Last Post by sierrainfo
0

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...

0
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

0

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

1

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>

Votes + Comments
Well spotted!
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.