最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
有滚动条、固定Header的ASP.Net DataGrid实现
时间:2022-06-30 10:21:41 编辑:袖梨 来源:一聚教程网
客户要一个有滚动条的ASP.Net DataGrid控件,只好写了:
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Web.UI.Design.WebControls;
using System.Text;
using System.Drawing;
[assembly:TagPrefix("Microsoft.Gtec.Dsv", "gtecdsv")]
namespace Microsoft.Gtec.Dsv
{
///
/// Summary description for WebCustomControl1.
///
[ToolboxData("<{0}:ScrollableFixedHeaderDataGrid runat=server>{0}:ScrollableFixedHeaderDataGrid>")]
public class ScrollableFixedHeaderDataGrid: System.Web.UI.WebControls.DataGrid
{
protected override void Render(HtmlTextWriter output)
{
//Use this flag to determine whether the component is in design-time or runtime.
//The control will be rendered differently in IDE.
//Don't bother to use DataGridDesigner.GetDesignTimeHtml
bool designMode = ((Site != null) && (Site.DesignMode));
//Backing up the properties need to change during the render process
string tempLeft = Style["LEFT"];
string tempTop = Style["TOP"];
Unit tempTABLE-LAYOUT"];
//Render a "
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Web.UI.Design.WebControls;
using System.Text;
using System.Drawing;
[assembly:TagPrefix("Microsoft.Gtec.Dsv", "gtecdsv")]
namespace Microsoft.Gtec.Dsv
{
///
/// Summary description for WebCustomControl1.
///
[ToolboxData("<{0}:ScrollableFixedHeaderDataGrid runat=server>{0}:ScrollableFixedHeaderDataGrid>")]
public class ScrollableFixedHeaderDataGrid: System.Web.UI.WebControls.DataGrid
{
protected override void Render(HtmlTextWriter output)
{
//Use this flag to determine whether the component is in design-time or runtime.
//The control will be rendered differently in IDE.
//Don't bother to use DataGridDesigner.GetDesignTimeHtml
bool designMode = ((Site != null) && (Site.DesignMode));
//Backing up the properties need to change during the render process
string tempLeft = Style["LEFT"];
string tempTop = Style["TOP"];
Unit tempTABLE-LAYOUT"];
//Render a "
" container with scrollbars.
output.WriteBeginTag("div");
output.WriteAttribute("id",ID + "_div");
output.WriteAttribute("style",
"HEIGHT: " + Height + ";" +
//Leave 20px for the vertical scroll bar,
//assuming the end-user will not set his scroll bar to more than 20px.
"WIDTH: " + (Width.Value + 20) + "px;" +
"TOP: " + Style["TOP"] + ";" +
output.WriteBeginTag("div");
output.WriteAttribute("id",ID + "_div");
output.WriteAttribute("style",
"HEIGHT: " + Height + ";" +
//Leave 20px for the vertical scroll bar,
//assuming the end-user will not set his scroll bar to more than 20px.
"WIDTH: " + (Width.Value + 20) + "px;" +
"TOP: " + Style["TOP"] + ";" +
相关文章
- 王者荣耀侦探能力大测试攻略 王者荣耀侦探能力大测试怎么过 11-22
- 无期迷途主线前瞻兑换码是什么 11-22
- 原神欧洛伦怎么培养 11-22
- 炉石传说网易云音乐联动怎么玩 11-22
- 永劫无间手游确幸转盘怎么样 11-22
- 无期迷途主线前瞻兑换码是什么 无期迷途主线前瞻直播兑换码介绍 11-22
热门栏目
-
php教程
php入门 php安全 php安装 php常用代码 php高级应用 -
asp.net教程
基础入门 .Net开发 C语言 VB.Net语言 WebService -
手机开发
安卓教程 ios7教程 Windows Phone Windows Mobile 手机常见问题 -
css教程
CSS入门 常用代码 经典案例 样式布局 高级应用 -
网页制作
设计基础 Dreamweaver Frontpage js教程 XNL/XSLT -
办公数码
word excel powerpoint 金山WPS 电脑新手 -
jsp教程
Application与Applet J2EE/EJB/服务器 J2ME开发 Java基础 Java技巧及代码