帮助数据网格 [英] Help on data-grid

查看:81
本文介绍了帮助数据网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用数据集在数据网格中显示数据。现在我想选择数据网格行并在同一页面的文本框中将值提取到其中。


我的意思是我想选择行,即通过点击它我可以得到它的值。


任何帮助表示赞赏。

谢谢你。

Hi all,
I am displaying data in data-grid using dataset.Now I want to select row of data-grid and fetch the values into it in text-boxes on the same page.

I mean I want to select the row i.e, by clicking it I can get the values into it.

Any help is appreciated.
Thank u.

推荐答案

这篇文章可能有所帮助:
对DataGrid Web控件的广泛检查
Here is an article that may help:
An Extensive Examination of the DataGrid Web Control



这篇文章可能有所帮助:
对DataGrid Web控件的广泛检查



谢谢,

但我不想更新或编辑datagrid中的数据是他们唯一的。我希望选择一个特定的行和点击事件我希望得到该行的值。

并希望在数据网格外的文本框中显示这些记录。


请帮助。

thanks,
but I don''t want to update or edit data in datagrid their only.Rather I want to select a particular row and on click event I want to get the values in that row.
And want to display these records in text-boxes outside of data-grid.

Pls help.



谢谢,

但我不想更新或编辑datagrid中的数据我希望选择一个特定的行,然后在点击事件中我想获取该行中的值。

并希望在数据网格外的文本框中显示这些记录。 />

请帮助。
thanks,
but I don''t want to update or edit data in datagrid their only.Rather I want to select a particular row and on click event I want to get the values in that row.
And want to display these records in text-boxes outside of data-grid.

Pls help.



hi aspamit,

在定义datagrid时,也设置其itemcommand属性。例如。

< asp:DataGrid id = ..... OnItemCommand =" grid_selectcommand" />

定义其列时,

< columns>

< asp:BoundColumn HeaderText ="选择" Buttontype =" Pushbutton" text =" select" commandname ="选择" />

i希望到这里你会跟着。

现在你的代码,

void grid_selectcommand(object sender,DataGridCommandEventArgs e)

{

Tablecell itemcell1 = e.item.cells [1]

Tablecell itemcell2 = e.item.cells [ 2]



这里e.item是引发命令的表的行。

为绑定列的值存储在tablecell的text属性中。

所以要检索数据网格外的文本框中的值,你可以给出text1.text = itemcell1.text

text2 .text = itemcell2.text等等(假设你已经在你的网页中声明了文本框。

希望这会有所帮助。任何疑惑或错误都可以随意发布。

hi aspamit,
when you are defining the datagrid, set its itemcommand property also. for eg.
<asp:DataGrid id = ..... OnItemCommand = "grid_selectcommand"/>
while defining its columns,
<columns>
<asp:BoundColumn HeaderText = "Select" Buttontype= "Pushbutton" text = "select" commandname = "Select"/>
i hope till here you would have followed.
now in your code,
void grid_selectcommand(object sender,DataGridCommandEventArgs e)
{
Tablecell itemcell1 = e.item.cells[1]
Tablecell itemcell2 = e.item.cells[2]
and so on
here e.item is the row of the table where the command is raised.
for bound columns the value is stored in the text property of the tablecell.
so to retrieve the values in the textboxes outside the data grid, you can give text1.text = itemcell1.text
text2.text = itemcell2.text and so on (assuming you have declared textboxes in your web page.
hope this helps. any doubts or error pls feel free to post it again.


这篇关于帮助数据网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆