tags:

views:

778

answers:

3

hi guys, I have a gridview in which itemtemplate contains hiddenfield.I have a button outside gridview.In the click event of button ,i want to get the value of hiddenfield of Rows(0),means first row.Can anybody help?

+3  A: 

Try:

string hiddenFieldValue = ((HiddenField) yourGridView.Rows[0].FindControl("yourHiddentFieldName")).Value;

(sorry it's not in VB.Net but I can't write in that language).

Ian Kemp
+2  A: 

In simple way

HiddenField hdf = (HiddenField)grd.Rows[0].FindControl("hidden1");
    String value = hdf.Value;
Muhammad Akhtar
+1  A: 

DirectCast(GridView.Rows(0).FindControl("MyHiddenField"),HiddenField).Value is the VB version.

PhilPursglove