Hi,
in my application a gridvie containing datas. if i select a row i want to display 2 cell values in to
2 textboxes.
how it is possible. i need the code in vb.net
Thanks in advance
K L BAIJ
Hi,
in my application a gridvie containing datas. if i select a row i want to display 2 cell values in to
2 textboxes.
how it is possible. i need the code in vb.net
Thanks in advance
K L BAIJ
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
ShankeyRank #972 · 2.1K reputationPosted Aug 27, 2010, 7:02 AM EDT
Following is your solution and please mark my answer as accepted if it helped you :)
1. Following is your aspx file code:
first you need to add Command name and Command argument to the row.
The value for the CommandName can be "Edit"
The value for the CommandArgument =' <%#Container.DataItemIndex %>'
Generate onRowCommand event for your grid
OnRowCommand="sampleGrid_RowCommand"
On RowCommand event of the grid you can get the index of the grid and then you can load values using that index.
2. following is row command code for you .vb file
Protected Sub SampleGrid_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles SampleGrid.RowCommand
If e.CommandName = "Edit" Then
Load_Data_To_TextBox(e.CommandArgument)
End If
End Sub
Private Sub Load_Data_To_TextBox(ByVal index As Integer)
'Get data using index of clicked row and show it in textbox
End Sub
If you are not clear with aspx code then please post your aspx grid code also. I will give aspx code also.