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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
ShankeyPosted Aug 27, 2010, 11:02 AM
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.