vrao92
asked on
Reading gridview value
I want to read a column value in MS gridview control using FOR loop. I will basically comparing the value in each row for that column and then I will have to put that row in edit mode if the values of that row match with what I have in a variable.
How would I do that? Please help
How would I do that? Please help
ASKER
I converted this code to Vb.net and this is what I have
Dim sValue As String
For i As Integer = 0 To GridView3.Rows.Count - 1
sValue = GridView3.Rows(i).Cells(4) .ToString( )
Next
And in my imeediate window I typed in ?svalue and I get this.. System.Web.UI.WebControls. DataContro lFieldCell
but not the value
Dim sValue As String
For i As Integer = 0 To GridView3.Rows.Count - 1
sValue = GridView3.Rows(i).Cells(4)
Next
And in my imeediate window I typed in ?svalue and I get this.. System.Web.UI.WebControls.
but not the value
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you..I tried and it worked.
Got the solution, see below
Cells[2] .. where 2 is the column index which we need.
for (int i = 0; i < GridViewHW.Rows.Count; i++)
{
string value = GridViewHW.Rows[i].Cells[2
}