G
Guest
Hello,
I'm trying to collect information from a GridView. Basically, the user
clicks on a buttonfield (which is a link button) and then I need to get the
information displayed on the gridview cells populates some components on the
screen.
I'm trying the following:
--------- Start of the code ---------
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "cod")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = GridView1.Rows[index];
TextBox1.Text = Server.HtmlDecode(row.Cells[2].Text);
TextBox2.Text = Server.HtmlDecode(row.Cells[3].Text);
Session.Add("edit_cod", Server.HtmlDecode(row.Cells[0].Text));
}
}
--------- End of the code ---------
The problem is that using this method I can retrieve only the value for Cell
2, which is a BoundField. Cell 0 is a link button and cell 3 is a
HyperlinkField and the comands above give me an empty string.
I'm still struggling a bit with C# and ASP.NET, so any help would be useful.
Thanks a lot!
Ruy.
I'm trying to collect information from a GridView. Basically, the user
clicks on a buttonfield (which is a link button) and then I need to get the
information displayed on the gridview cells populates some components on the
screen.
I'm trying the following:
--------- Start of the code ---------
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "cod")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = GridView1.Rows[index];
TextBox1.Text = Server.HtmlDecode(row.Cells[2].Text);
TextBox2.Text = Server.HtmlDecode(row.Cells[3].Text);
Session.Add("edit_cod", Server.HtmlDecode(row.Cells[0].Text));
}
}
--------- End of the code ---------
The problem is that using this method I can retrieve only the value for Cell
2, which is a BoundField. Cell 0 is a link button and cell 3 is a
HyperlinkField and the comands above give me an empty string.
I'm still struggling a bit with C# and ASP.NET, so any help would be useful.
Thanks a lot!
Ruy.