Using C# & Mysql
In my webpage am using gridview, if i click the column in the girdview the value should display in the textbox.
For Example
Griview
Column1 column2 Column3
1 Raja 9876
2 Ravi 7890
3 Ramu 9879
...
If i click the 2 rows all the values should display in the textbox
Textbox1.text = 2
textbox2.text = Ravi
textbox3.text = 9879
...,
How to write a code for this condition.
Need C# code Help
I’m assuming that by stating “[…]click the 2 rows[…]” you actually mean “click the 2nd row“; at least, this is what your last snippet suggests, since it shows only the values of the 2nd row (on a little side note: the ID’s wrong there; it should be
7890).The following code snippet shows a
GridViewwhich allows the selection of a single row, and uses an event handler in the code-behind to set the text of eachTextBoxto the according value in the selected row:Page.aspx:
Event handler in the code-behind file Page.aspx.cs: