How to programatically set GridView selected row?

1

11D.Universe

I've got a GridView control (GridView1) containing several fields
(Field1, Field2, ...) from a SQL table

If I set the selected row using: GridView1.SelectedIndex=1

Then how do I get the value of one of the fields in that row - say
Field2?
 
S

Sriram Surapureddy

you can use

((TextBox)GridView1.SelectedRow.FindControl("controlname")).text
assuming the field is type of textbox.You can typecast it wahtever the type
of the control.
Hope this helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top