如何从GridView获取价值到文本框? [英] How to get value from gridview into textbox?
问题描述
你好,
需要有人展示如何从gridview列中获取价值到文本框中.
例如,如果我有带有2列ID和EMAIL的EmailGridview.并希望在gridview下在文本框中也显示Email值.
我仍在学习vb.net,我正尝试做许多选择,但以某种方式无法获得结果.
这是我最近的代码:
EmailTextBox.text = EmailGridView.rows(0).cells(email)
但是,它当然不起作用.
有关信息,我正在使用asp.net vb.net在可视化Web开发人员中工作.项目是邮件表格.
预先感谢您对任何人的帮助.
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.
推荐答案
此 [ ^ ]线程可能对您.
This[^] thread may be of some assistance to you.
是的,当然,我需要在最后添加 .text.tostring
谢谢Abhinav的提示.
Yes of course, I was need to add in the end .text.tostring
Thank you Abhinav for tips.
尊敬的Dejan
首先,您需要将焦点设置为该特定的单元格,然后选择值,这是我所做的
在属于gridview的linkbutton上,添加一个click事件,然后在后面的代码中执行以下操作
_____________
子rowval1(ByVal发送者为对象,ByVal e为EventArgs)
昏暗的gvRow为GridViewRow = CType(CType(sender(sender,Control).Parent.Parent,GridViewRow)
Dim I Int32 = gvRow.RowIndex
carid = Me.GridView1.Rows(I).Cells(0).Text
msgbox(carid)
结束子
哈桑·雷扎
Hasanreza@hotmail.com
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
这篇关于如何从GridView获取价值到文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!