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>
/// Summary description for WebCustomControl1.
/// </summary>
[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 tempHeight = Height;
string tempTableStyle = Style["TABLE-LAYOUT"];
//Render a "<div>" 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"] + ";" +
"LEFT: " + Style["LEFT"] + ";" +
"POSITION: " + Style["POSITION"] + ";" +
"OVERFLOW-X: auto;" +
"Z-INDEX: " + Style["Z-INDEX"] + ";" +
//Render the scrollbar differently for design-time and runtime.
"OVERFLOW-Y: " + (designMode?"scroll":"auto")
);
output.Write(HtmlTextWriter.TagRightChar);
//The DataGrid is inside the "<div>" element, so place it at (0,0).
Style["LEFT"] = "0px";
Style["TOP"] = "0px";
//Render the DataGrid.
base.Render(output);
output.WriteEndTag("div");
//Restore the values
Style["LEFT"] = tempLeft;
Style["TOP"] = tempTop;
//The following rendering is only necessary under runtime. It has negative impact during design time.
if (!designMode)
{
//Render another copy of the DataGrid with only headers.
//Render it after the DataGrid with contents,
&
[1] [2] [3] [4] [5] 下一页
[Web开发]一个关于ASP运行时间计算的代码 [Web开发]ASP:检测含有中文字符串的实际长度
[Web开发]asp 中英文字符长度检测判断函数 [Web开发]安全维护 IIS asp 站点的高级技巧
[Access]ASP&SQL让select查询结果随机排序的实现方法 [Web开发]ASP字符串截取函数
[Web开发][asp]关键词只替换一次的写法 [Web开发]Asp无组件生成缩略图方法详解
[Web开发]asp编程中优化数据库方法详解 [Web开发]三种方法教你asp如何去除html标记