Retrieve information from Hyperlink and Button field on a GridView

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top