-2

I have a grid view displaying search results.

Once a field is selected, the data should be displayed in text boxes.

What's the code to fill text boxes when a row of a data grid view is clicked?

I've tried the code that is shown below. It returns an error.

TextBox1.Text = GridView1.SelectedRow[0].Cell[1].Value.ToString();
LordHits
  • 5,054
  • 3
  • 38
  • 51
user2561472
  • 17
  • 2
  • 7

2 Answers2

1

Index of Currently Selected Row in DataGridView

There you have all you want.

Next time try to use google, or search on that site, before you ask.

Community
  • 1
  • 1
Maciek
  • 523
  • 1
  • 4
  • 8
0

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview(v=vs.110).aspx

Gridview has lot of events associated with it. based on the location of the text boxes, you may want to use RowEditing event or SelectedIndexChanged event.

Kiran
  • 1