行创建的datagrid视图处理程序 [英] row created handler of datagrid view

查看:65
本文介绍了行创建的datagrid视图处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些包含4列的数据源,然后使用databind将这些数据绑定到gridview.这使行创建的处理程序被调用.是否可以在rowcreated处理函数中获取数据源数据?

谢谢

解决方案

可以通过参数访问

在此处查看最后一个示例

http://msdn. microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcreated%28v=vs.80%29.aspx [ e.Rows GridViewRow gr = e.Row;



每行都有单元格的集合

因此,要获取每个单元格的实例,可以使用e.Rows.Cells [index]

其中index =您要访问的列

用于单元格字符串的文本

 str = e.Row.Cells [ 0 ].Text; 





 e.Row.Cells [ 0 ].Text = " 让我成为我"; 


I have some data source containing 4 column and then I bind these data to a gridview using databind. This makes rowcreated handler to be invoked. Is it possible to get the datasource data in the rowcreated handler function?

Thanks

it can be accessed by arguments

check last example here

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcreated%28v=vs.80%29.aspx[^]


u can get the complete row instance by

e.Rows GridViewRow gr = e.Row;



each row has collection of cells

so to get instance of each cell u can u use e.Rows.Cells[index]

where index = column u want to access

for text of a cell string

str = e.Row.Cells[0].Text; 



or

e.Row.Cells[0].Text = "its me";


这篇关于行创建的datagrid视图处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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