Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET VB.NET
Hello,
 
Need someone to show how to get value from gridview column into textbox.
For example if I have EmailGridview with 2 columns ID, and EMAIL. And would like under gridview to show Email value also in textbox.
 
I'm still learning vb.net, and I was trying to do many options, but somehow could not get result.
 
This is nearest I was with the code:
EmailTextBox.text = EmailGridView.rows(0).cells(email)
 
But, of course it is not working.
 
For info, I'm working in visual web developer with asp.net vb.net. Project is mail form.
 
Thank you in advance for help to anyone.
Posted 12-Feb-11 7:16am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This[^] thread may be of some assistance to you.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

EmailTextBox.text = EmailGridView.rows(0).cells("email").value
 
try this...
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Yes of course, I was need to add in the end .text.tostring
 
Thank you Abhinav for tips.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Dear Dejan
 
First you need to get the focus set to that particular cell and then pick the value , here is what i have done
On a linkbutton which is part of the gridview add a on click event and then in the code behind do the below
 

_____________
 
Sub rowval1(ByVal sender As Object, ByVal e As EventArgs)
 
Dim gvRow As GridViewRow = CType(CType(sender, Control).Parent.Parent, GridViewRow)
Dim I As Int32 = gvRow.RowIndex
 
carid = Me.GridView1.Rows(I).Cells(0).Text
 
msgbox(carid)
End sub
 
HasanReza
 
Hasanreza@hotmail.com
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 389
1 Sergey Alexandrovich Kryukov 362
2 CPallini 130
3 Abdul Samad KP 125
4 Richard MacCutchan 110
0 OriginalGriff 6,249
1 Sergey Alexandrovich Kryukov 5,680
2 CPallini 4,850
3 George Jonsson 3,454
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 9 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100