对DataGrid的分页栏的理解
2004-11-10 02:38
381 查看
昨天在Csdn回答一位朋友的问题时,恰巧碰到这样的问题,我有些疑惑,所以晚上回家就试了一下,后来才发现是自已错啦.在这里我想纠正自已的错误.
DataGrid的分页栏控件的组成及各自的功能
1.DataGrid的分页栏由三个控件组成.分别为:
1.System.Web.UI.WebControls.Label
2.System.Web.UI.LiteralControl
3.System.Web.UI.WebControls.DataGridLinkButton
其中每个控件有每个控件的作用.
##Label负责显示当前页,也就是选择页.
##LiteralControl负责显示一个空格,用来间隔它们之间的距离
##DataGridLinkButton显示连接,用来连接到其它页,如下一页.
这样就可以很轻松地回答昨于那位朋友的问题啦
原题:
[小弟想要做DataGrid,什么效果呢,要分页
1 2 3 4,当我选中第2页时,2的颜色要跟1 3 4不一样。
就像CSDN的分页一样一样一样的啊]
实现:
namespace Text_WebApp
效果图:
posted on 2004-07-19 10:45 笨笨 阅读(115) 评论(2) 编辑 收藏
'突出显示当前页
Dim Item As DataGridItem
Dim ctrl As Control
For Each Item In dg.Controls(0).Controls
If Item.ItemType = ListItemType.Pager Then
For Each ctrl In Item.Cells(0).Controls
If ctrl.GetType.ToString = "System.Web.UI.WebControls.Label" Then
If CType(ctrl, Label).Text = (dg.CurrentPageIndex + 1).ToString Then
CType(ctrl, Label).ForeColor = Color.Red
Exit For
End If
End If
Next
End If
Next
# re: 对DataGrid的分页栏的理解 我常用这样的方法:
'突出显示当前页
Dim Item As DataGridItem
Dim ctrl As Control
For Each Item In dg.Controls(0).Controls
If Item.ItemType = ListItemType.Pager Then
For Each ctrl In Item.Cells(0).Controls
If ctrl.GetType.ToString = "System.Web.UI.WebControls.Label" Then
If CType(ctrl, Label).Text = (dg.CurrentPageIndex + 1).ToString Then
CType(ctrl, Label).ForeColor = Color.Red
Exit For
End If
End If
Next
End If
Next
DataGrid的分页栏控件的组成及各自的功能
1.DataGrid的分页栏由三个控件组成.分别为:
1.System.Web.UI.WebControls.Label
2.System.Web.UI.LiteralControl
3.System.Web.UI.WebControls.DataGridLinkButton
其中每个控件有每个控件的作用.
##Label负责显示当前页,也就是选择页.
##LiteralControl负责显示一个空格,用来间隔它们之间的距离
##DataGridLinkButton显示连接,用来连接到其它页,如下一页.
这样就可以很轻松地回答昨于那位朋友的问题啦
原题:
[小弟想要做DataGrid,什么效果呢,要分页
1 2 3 4,当我选中第2页时,2的颜色要跟1 3 4不一样。
就像CSDN的分页一样一样一样的啊]
实现:
namespace Text_WebApp
效果图:
posted on 2004-07-19 10:45 笨笨 阅读(115) 评论(2) 编辑 收藏
评论
# re: 对DataGrid的分页栏的理解
我常用这样的方法:'突出显示当前页
Dim Item As DataGridItem
Dim ctrl As Control
For Each Item In dg.Controls(0).Controls
If Item.ItemType = ListItemType.Pager Then
For Each ctrl In Item.Cells(0).Controls
If ctrl.GetType.ToString = "System.Web.UI.WebControls.Label" Then
If CType(ctrl, Label).Text = (dg.CurrentPageIndex + 1).ToString Then
CType(ctrl, Label).ForeColor = Color.Red
Exit For
End If
End If
Next
End If
Next
# re: 对DataGrid的分页栏的理解 我常用这样的方法:
'突出显示当前页
Dim Item As DataGridItem
Dim ctrl As Control
For Each Item In dg.Controls(0).Controls
If Item.ItemType = ListItemType.Pager Then
For Each ctrl In Item.Cells(0).Controls
If ctrl.GetType.ToString = "System.Web.UI.WebControls.Label" Then
If CType(ctrl, Label).Text = (dg.CurrentPageIndex + 1).ToString Then
CType(ctrl, Label).ForeColor = Color.Red
Exit For
End If
End If
Next
End If
Next
相关文章推荐
- 2004-11-10 咖啡、寂寞、音乐、夜......
- 有条件地格式化DataGrid单元格
- [原创]STL Iterator,traits学习笔记
- Windows网络编程总结(二)
- 风潇潇兮
- Tomcat5集群性能测试!
- Duwamish Web Services分析篇
- NND,今天又睡晚了
- FireFox 终于来了?
- IIS Url ReWriting 示例
- SharePoint的定制
- (转载)初学者如何熟悉Linux内存管理
- 个人主页系统在Apache上的实现方法
- 如何从一个php文件向另一个地址post数据,不用表单和隐藏的变量
- 刚刚收集的图片 来和大家分享 ^_^
- eclipse可视化插件
- 模式与设计模式概述
- 谈人生,哈哈
- PHP下一个方便易用的模板处理类
- 用Visual C#实现局域网点对点通讯