Click here to Skip to main content
15,921,463 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to read a particular cell value from grid..............?
Posted

try like this:
GridView1.SelectedRow.Cells(0).Text
in gridview selectedIndexChange event
VB
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
       Response.Write(GridView1.SelectedRow.Cells(0).Text)
   End Sub
 
Share this answer
 
Actually there are different ways to access values from particular cell. so, specify on which event you want to access.

If you have button control in row then u can use rowcommand event. (It is known as bubble event)

If you are accessing gridview from outside then you can use foreach loop

You can use .cells[0] property if it is bound field. and if it is other control then you can use .findcontrol("") and then get those value.

Please give clear details about your problem/issue so that there should not be any gesswork.

:-)
 
Share this answer
 
v2
i want to fetch a column value from grid..its a bound field..pls specify how..i used
dispoid = gvReport.Rows(e.RowIndex).Cells(0).Text and
also dispoid = Rows.Cells(0).Text
am getting an error like this

Error 2 'RowIndex' is not a member of 'System.EventArgs'.

but couldnt return d row value...plz help...
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900