Click here to Skip to main content
12,448,563 members (54,666 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB 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 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  
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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160811.3 | Last Updated 9 Nov 2012
Copyright © CodeProject, 1999-2016
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