Author: tous0024 | Posted on: 12/30/2009 11:34:05 AM | Views : 573

 Group,
I have a GridView that has a TemplateField (ID ="lblID") and I am trying to use FindControl to get the value in the corresponding row so I can delete it out of a database using the OnRowDeleting method.
I have a SQL statement that says DELETE FROM myTable WHERE ID = @ID
And I am trying to set @ID to the value of the TemplateField of the row being clicked on.  In my codebehind I have pieced together the following (which isn't working):
cmdQC.Parameters.Add("@ID", SqlDbType.Int, 4).Value = Convert.ToInt32(gvCRMData.Rows[e.RowIndex].FindControl("lblID").ToString());
Anyone have any suggestions?
 
...

Go to the complete details ...