从DataTable在GridView内写入标签文本 [英] write text of label inside GridView from DataTable

查看:77
本文介绍了从DataTable在GridView内写入标签文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在GridView中有一个Label和一个数据表.我想从数据表的列值中写入Label的文本.

I have a Label inside GridView and a datatable. I want to write text of Label from datatable column value.

推荐答案

这样做的最合乎逻辑的方法是,使标签成为数据表呈现数据的一部分
The most logical way to do this, is to make the label part of the data your datatable is rendered from, so you don''t have to jump through hoops to work it out.


只需将标签与数据表columnName绑定,如下所示

Just Bind that label with datatable columnName like below


您可以通过
以图形方式进行此操作
1.单击网格视图中标签处的箭头符号
2.单击编辑数据绑定
3选择自定义绑定
4在代码表达式中添加Eval("datatable column field")
you can do this graphicaly by

1. click on arrow symbol at label in grid view
2. click edit data bindings
3 select custom bindings
4 in code expression add Eval("datatable column field")


这篇关于从DataTable在GridView内写入标签文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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