应该使用哪个事件将值从GridView传递到文本框. [英] Which event should be used to pass value from GridView to textbox.
问题描述
大家好,
伙计们,应该使用哪个事件将值从GridView传递到文本框.
让我解释一下,我有一个这样的表格,
输入详细信息后,有4个文本框,分别是州,地区,城市和密码.保存按钮将上述所有内容保存到网格中.如果用户要编辑,则他/她将单击网格中的任意行,该行又应分别在文本框中显示州,地区,城市和密码.这是我的问题.
如何从网格视图到文本框显示值/文本
谁能帮我..,我被困住了.在此先感谢
Hi everyone,
Guys which event should be used to pass value from GridView to textbox.
Let me explain, i have a form like this,
have got 4 textboxes viz., state, district, City and pincode after entering details a save button which saves all the above mentioned to a grid. If a user wants to edit he/she will click a any row in a grid which in turn should display state, district, City and pincode respectively in the text boxes and this is my problem.
How to display value/text from gridview to text box
Can anyone help me..,i''m stuck. Thanks in advance
推荐答案
,您有3种显示方式.
1.使用selectedindexchanged事件,在该事件中,您可以获取选定索引的值(行值)并将其传递给文本框
2.使用Editindex event,您可以通过将textbox放置在gridview中来直接更改值
3.使用行命令事件
you have 3 ways to show.
1. use selectedindexchanged event, in which you can get the values of a selected index (row values) and pass it to textboxes
2. Use Editindex event , with which you can directly chnage the values by placing textboxes inside the gridview
3. use row command event
,它很容易在编辑项目模板中的文本框中使用gridview编辑. 您只需在编辑项目模板中将数据绑定到文本框即可.
通过选择文本框的编辑数据绑定
选择自定义绑定
在代码表达式中添加
its simple to use gridview editing with text boxes in edit item templates..
you can simply bind data to textboxes in edit item templates..
by selecting edit data bindings of text box
choose custom binding
in code expression add
Eval("dataset field")
这篇关于应该使用哪个事件将值从GridView传递到文本框.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!