web developer tips (64): 在GridView中转换BoundField为TemplateField
来源:互联网 发布:手机录像软件推荐 编辑:程序博客网 时间:2024/05/22 00:44
原文地址:How to convert a GridView column from asp:BoundField to asp:TemplateField in Design View
假定你有个数据源SqlDataSource1 ,绑定了一个简单的查询语句,返回Customers表的详细信息。
http://www.watch-life.net/visual-studio/convert-a-gridview-column-from-boundfield-to-templatefield.html
ConnectionString=""
SelectCommand="SELECT [FirstName], [LastName], [Email] FROM [Customers] ORDER BY
[FirstName]">
在Visual Studio里,在web forms 页面的设计视图添加一个GridView,选择 SqlDataSource1作为数据源,通常GridView 列会生成 BoundField型数据
DataSourceID="SqlDataSource1">
SortExpression="FirstName" />
SortExpression="LastName" />
通常,你想自定义一列或多列从BoundField转换到TemplateField,这里我们把Email列转换成TemplateField。在GridView的智能标签面板里单击“Edit Columns”。然后在弹出的对话框选择“Email”字段,并单击“Convert this field into a TemplateField”
Email 字段的代码会进行更新,如下所示:
对于DetailsView控件,也可以参照类似的方法去做,在DetailsView的智能标签面板选择“Edit Fields”即可。
更多文章见:守望轩[http://www.watch-life.net/]
- web developer tips (64): 在GridView中转换BoundField为TemplateField
- GridView中BoundField与TemplateField的区别
- GridView中BoundField与TemplateField的区别
- 【boundfield】GridView中BoundField与TemplateField的区别_boundfield
- web developer tips (53):在vs的设计视图编辑gridview的模板
- BoundField与TemplateField的区别
- PL/SQL Developer中转换大小写工具
- 在Makefile中转换大小写
- 在GridView控件中使用TemplateField
- 在GridView控件中使用TemplateField
- 在GridView控件中使用TemplateField
- web developer tips (19):设置默认视图为设计视图
- java中转换为字符串的方法
- js中转换字符串为JSON格式
- web developer tips (21):为Developer Web Server设定固定端口
- web developer tips (84):在Visual Web Developer中设置web网站的起始页
- 巧借Excel另存功能,在VFP中转换表格为CSV格式
- 已调试好的asp程序在VB中转换为组件的技巧
- 文件编码的判定(UTF8,UTF16),及转换
- 设计模式笔记(1)---开篇
- WM 操作cemail.vol
- 常用到得系列按钮css样式
- msn升级问题
- web developer tips (64): 在GridView中转换BoundField为TemplateField
- MFC/C++/C中字符类型CString, int, string, char*之间的转换
- 防止输入Html标记的方法
- propertysheet
- C 宏定义的简单总结
- wince5.0 的重启以及待机后的叫起
- 【转+原】linux程序员面试题
- 修身养性,为人处事100条
- RegularExpressionValidator控件中正则表达式用法~