扩展DataGrid控件,能够实现多列排序,自定义标题,动态增加表头等

这几天做了个DataGrid扩展控件,如题。但是由于工作忙,打算过一段时间对它完善,放到这里备忘,也给大家看看,提些意见,给一些启发,asp.net我也是刚用不久,QQ:8613441

演示地址

[WebForm1.aspx]

<% @ Register TagPrefix="cc1" Namespace="XLCtrlLib" Assembly="XLCtrlLib"  %>
<% @ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="TestXDataGrid.WebForm1"  %>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"  >
< HTML >
    
< HEAD >
        
< title > WebForm1 </ title >
        
< meta  content ="Microsoft Visual Studio .NET 7.1"  name ="GENERATOR" >
        
< meta  content ="C#"  name ="CODE_LANGUAGE" >
        
< meta  content ="JavaScript"  name ="vs_defaultClientScript" >
        
< meta  content ="http://schemas.microsoft.com/intellisense/ie5"  name ="vs_targetSchema" >
    
</ HEAD >
    
< body  MS_POSITIONING ="GridLayout" >
        
< form  id ="Form1"  method ="post"  runat ="server" >
            
< FONT  face ="宋体" >
                
< cc1:XDataGrid  id ="XDataGrid1"  style ="Z-INDEX: 101; LEFT: 312px; POSITION: absolute; TOP: 176px"
                    runat
="server"  Width ="80px"  Height ="40px"  ImagePath ="Common/Images/Office2003/ToolBar/" ></ cc1:XDataGrid >
                
< cc1:XDataGrid  id ="XDataGrid2"  style ="Z-INDEX: 102; LEFT: 344px; POSITION: absolute; TOP: 312px"
                    runat
="server"  Width ="104px"  Height ="24px"  ImagePath ="Common/Images/Office2003/ToolBar/" ></ cc1:XDataGrid ></ FONT ></ form >
    
</ body >
</ HTML >

 

[WebForm1.aspx.cs]

using  System;
using  System.Collections;
using  System.ComponentModel;
using  System.Data;
using  System.Drawing;
using  System.Web;
using  System.Web.SessionState;
using  System.Web.UI;
using  System.Web.UI.WebControls;
using  System.Web.UI.HtmlControls;

namespace  TestXDataGrid
{
    
/// <summary>
    
/// WebForm1 的摘要说明。
    
/// </summary>

    public class WebForm1 : System.Web.UI.Page
    
{
        
protected XLCtrlLib.XDataGrid XDataGrid2;
        
protected XLCtrlLib.XDataGrid XDataGrid1;
    
        
private void Page_Load(object sender, System.EventArgs e)
        
{
            
// 在此处放置用户代码以初始化页面
            if(!this.IsPostBack)
            
{
                
this.XDataGrid1.SqlQuery = "SELECT * FROM s_dict";
                
this.XDataGrid1.xPageSize = 8;
                
this.XDataGrid1.AddColumn("RID""流水号"1000);
                
this.XDataGrid1.AddColumn("IKEY"""1000);
                
this.XDataGrid1.AddColumn("IVALUE"""2000);

                
this.XDataGrid2.SqlQuery = "SELECT * FROM s_dict";
                
this.XDataGrid2.xPageSize = 5;
                
this.XDataGrid2.AddColumn("RID""流水号"1000);
                
this.XDataGrid2.AddColumn("IKEY"""1000);
                
this.XDataGrid2.AddColumn("IVALUE"""2000);
            }

        }


        
Web 窗体设计器生成的代码
    }

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值