Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
All-Star
127087 Points
17946 Posts
MVP
Dec 17, 2007 05:00 AM|LINK
Since you are using the SELECT CommandField then you can have something like this
Page2.Aspx
protected void Button1_Click(object sender, EventArgs e) { for (int i = 0; i < GrdiView1.Rows.Count; i++) { if (GrdiView1.SelectedIndex == i) { String name =GridView1.Rows[i].Cells[1].Text; //Gets the data value in the grid; Session["Value"] = name; Response.Redirect("Page1.aspx"); } } }
Page1.aspx
protected void Page_Load(object sender, EventArgs e) { string RowValue = Session["Value"].ToString();
TextBox1.Text = RowValue; }
vinz
All-Star
127087 Points
17946 Posts
MVP
Re: Retrieve select row.cell from Gridview and display in Textbox
Dec 17, 2007 05:00 AM|LINK
Since you are using the SELECT CommandField then you can have something like this
Page2.Aspx
protected void Button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < GrdiView1.Rows.Count; i++)
{
if (GrdiView1.SelectedIndex == i)
{
String name =GridView1.Rows[i].Cells[1].Text; //Gets the data value in the grid;
Session["Value"] = name;
Response.Redirect("Page1.aspx");
}
}
}
Page1.aspx
protected void Page_Load(object sender, EventArgs e)
{
string RowValue = Session["Value"].ToString();
TextBox1.Text = RowValue;
}
MessageBox Controls for WebForms | Blog | Twitter | Linkedin