elderCaptain
davyjiang@live.com 让软件即会跑步又会游泳
随笔- 3 文章- 60 评论- 4
博客园
首页
新随笔
联系
管理
订阅
改善 DataGrid 的功能,提高客户的体验 1
DataGrid 提供了丰富的数据显示功能,但在对其进行扩展却不是十分的容易。好在它提供了很多的接口供我们扩展。
OnItemCommand :对自定义按钮定义 CommandName ,可通过 CommandName 来区分实现不同的功能。
<EditCommandColumn></
EditCommandColumn> 内的接口
OnCancelCommand
OnEditCommand
OnUpdateCommand
Item 创建时的事件(只在 Create 时执行)
OnItemCreated
Item 数据绑定的事件 (在每次 render 时都执行)
OnItemDataBound
DataGrid 提供的
<EditCommandColumn></
EditCommandColumn> 可以实现对 Row 中的数据进行修改和提交,功能十分强大。但是却没有提供客户端的功能扩展。那我们应该怎么办呢?
好在 DataGrid 有个 OnItemDataBound 事件,这样我们就有机会在 OnUpdateCommand 执行之前增加客户端功能了。
实现代码如下:
protected
void
dgRankList_ItemDataBound(
object
sender, DataGridItemEventArgs e)
{
if
(e.Item.ItemType
==
ListItemType.EditItem)
{
WebControl okLbtn
=
(LinkButton) e.Item.Cells[
4
].Controls[
0
];
if
(okLbtn
!=
null
)
{
TextBox txtEditLower
=
(TextBox) e.Item.Cells[
1
].FindControl(
"
txtEditLower
"
);
TextBox txtEditUpper
=
(TextBox)e.Item.Cells[
1
].FindControl(
"
txtEditUpper
"
);
TextBox txtEditRank
=
(TextBox)e.Item.Cells[
1
].FindControl(
"
txtEditRank
"
);
okLbtn.Attributes.Add(
"
onclick
"
,
string
.Format(
"
return validateRankReg('{0}','{1}','{2}');
"
,
txtEditLower.ClientID, txtEditUpper.ClientID, txtEditRank.ClientID));
}
}
}
Tag标签:
开发-aspNet
posted on 2008-03-04 09:14
老大卫
阅读(36)
评论(0)
编辑
收藏
所属分类:
AspNet
新用户注册
刷新评论列表
标题
姓名
主页
Email
(博主才能看到)
验证码
*
看不清,换一张
[
登录
][
注册
]
内容(请不要发表任何与政治相关的内容)
网站首页
新闻频道
社区
小组
博问
网摘
闪存
找找看
Remember Me?
登录
使用高级评论
新用户注册
返回页首
恢复上次提交
[使用Ctrl+Enter键可以直接提交]
该文被作者在 2008-07-30 13:54 编辑过
相关文章:
温故知新ASP.NET 2.0(C#)(3) - SiteMap(站点地图)
ASP.NET 2.0数据教程之三:母板页和站点导航
Windows 2000 常见进程功能描述[转帖]
功能齐全的DataGrid
DataGrid锁定问题
关于DataGrid中的rules问题
webform的postback有很大改善空间啊。
DataGrid1 的AutoGenerateColumns问题
相关链接:
所属分类的其他文章:
让你的 Web App 飞起来——利用 .Net 的缓存机制
一个查询表达式生成器控件
改善 DataGrid 的功能,提高客户的体验 1
最新IT新闻:
Google股价跌破329美元 61%员工期权价值归零
十年祭:昔日明星软件今何在?
六大可能出售IT企业名单:SUN领头或被猎走
Linux内核2.6.27正式到来
《星际争霸2》一分为三 各种族依次登场
跟小D每日学口语
与我联系
发短消息
搜索
留言簿
(1)
给我留言
查看留言
我参与的团队
安徽.NET俱乐部(0/111)
我的标签
学习-aspNet-方法
(12)
学习-aspNet-理论
(11)
学习-Js-方法
(7)
Enterprise Library
(6)
开发-aspNet
(3)
学习-css
(3)
Linq
(1)
随笔分类
(3)
AspNet(3)
随笔档案
(15)
2008年5月 (7)
2008年4月 (3)
2008年3月 (4)
2007年11月 (1)
文章分类
(43)
c# aspNet(24)
Flex(1)
js css(15)
Proj uml(3)
相册
younger
最新随笔
1. Jquery post Best practice?
2. asp.net 中缓存的应用1
3. asp.net 方法:Gridview 2 Execl Exportar
4. asp.net 方法: Tag 使用技巧
5. flex book1
6. xslt 转换方法
7. Media Player在Web应用中的一些要点
8. 微软.Net开发中的多线程编程总结
9. C#访问非托管DLL
10. Global.asax 文件 使用参考
11. web 色标
12. ASP.NET跨页面传值的几种方法
13. Http 处理过程
14. ASP.NET的必须知道的东东(HttpModule,HttpHandler,页面周期)
15. byte[]放入ViewSate Session
16. 利用 Enterprise Library 改善你的应用系统6——Cryptograph Block
17. 利用 Enterprise Library 改善你的应用系统5——Exception Block
18. 利用 Enterprise Library 改善你的应用系统4——logging Block Application
19. 利用 Enterprise Library 改善你的应用系统3——Data Access Application Block
20. 利用 Enterprise Library 改善你的应用系统2——应用系统的配置管理
21. 利用 Enterprise Library 改善你的应用系统1
22. 让你的 Web App 飞起来——利用 .Net 的缓存机制
23. 一个查询表达式生成器控件
24. 设计模式4思考——对于一个简单"流程"的设计思考
25. 设计模式3实践——运用 C# 中的 delegate 简化设计模式的实现
26. 设计模式2思考——web框架中—页面功能设计的实现
27. 设计模式1实践-开篇
28. 看不懂的 neatUpload 控件
29. DataTable 实现真正的查询
30. 背景和弹出 Panel 都带有动画效果的 modal 效果
31. Linq2Sql DataContext 中的两个细节
32. 改善 DataGrid 的功能,提高客户的体验 1
33. 关于文件上传 fileupload 控件
34. xml 2 Table 的原则
35. Color Manual
36. ItemTemplate 中使用 Container.FindControl 得到服务器控件
37. ms ajax 中枚举定义 注释格式
38. ajax control toolkit 的开发
39. 重新认识 updatePanel
40. dictionary 的 reset 方法
最新评论
阅读排行榜
1. 背景和弹出 Panel 都带有动画效果的 modal 效果(96)
2. 设计模式3实践——运用 C# 中的 delegate 简化设计模式的实现(93)
3. 一个查询表达式生成器控件(80)
4. 让你的 Web App 飞起来——利用 .Net 的缓存机制(68)
5. 设计模式2思考——web框架中—页面功能设计的实现(54)
评论排行榜
1. 设计模式4思考——对于一个简单"流程"的设计思考(2)
2. 一个查询表达式生成器控件(1)
3. 背景和弹出 Panel 都带有动画效果的 modal 效果(1)
4. 设计模式1实践-开篇(0)
5. 设计模式2思考——web框架中—页面功能设计的实现(0)