Hiya
I have a GridView on an ASP.NET page with a TemplateField column that has a TextBox in the ItemTemplate. I then have a command field which is supposed to pull the text from this TextBox and use it in a SqlCommand running a stored procedure. The code is being from the OnRowCommand event from the gridview.
Here is my C# code:
Code:
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow selectedRow = this.gvwSNConfirm.Rows[index];
TableCell intID = selectedRow.Cells[1];
int reqID = int.Parse(intID.Text); </SPAN>
// Get the SN from the text box on the selected row </SPAN>
TableCell snCell = selectedRow.Cells[0];
TextBox tbox = (TextBox)snCell.FindControl("txtSN");
string stSN = tbox.Text.ToString(); <--the bit that doesnt work
I have no idea why this wont work. It is the same as another web form with the exception of the control names.
Can anyone point me in the right direction?
Thanks
MonkeyMan