看了這個控件,才發覺我的控件只是個嬰兒https://files.cnblogs.com/invinboy/DotNetGrid.rar,兄弟們可以下載這個用.可以去看看這個控件的功能http://invinboy.cnblogs.com/archive/2006/05/06/DotNetGrid.html.
參考別人的源碼,我寫了平生第一個DataGrid控件,不要笑我,有用的上的兄弟們儘管用,我調適過了,使用正常.以後我努力的自創出其他的控件,歡迎關注...
/Files/robin0925/DataGrid_itec.rar
調用方法:
1.将控件拖到Web Page , 設置分頁屬性
2.代碼中
DataGrid_itec.iTECDataGrid.DT = ds.Tables[0]; ***傳數據到Server Control
ITECDataGrid1.DataSource = ds.Tables[0];
ITECDataGrid1.DataBind(); ***Bind數據
參考別人的源碼,我寫了平生第一個DataGrid控件,不要笑我,有用的上的兄弟們儘管用,我調適過了,使用正常.以後我努力的自創出其他的控件,歡迎關注...
/Files/robin0925/DataGrid_itec.rar
調用方法:
1.将控件拖到Web Page , 設置分頁屬性
2.代碼中
DataGrid_itec.iTECDataGrid.DT = ds.Tables[0]; ***傳數據到Server Control
ITECDataGrid1.DataSource = ds.Tables[0];
ITECDataGrid1.DataBind(); ***Bind數據
using System;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace DataGrid_itec
{
/// <summary>
/// Summary description for iTECDataGrid.
/// </summary>
[DefaultProperty("Text"),
ToolboxData("<{0}:iTECDataGrid runat=server></{0}:iTECDataGrid>")]
public class iTECDataGrid : System.Web.UI.WebControls.DataGrid
{
Define
DisplayProtery
Proterty
/// <summary>
/// 將此控件呈現給指定的輸出參數
/// </summary>
/// <param name="e">要寫出到的HTML編寫器</param>
protected override void OnItemCreated(DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.Pager)
{
e.Item.Cells[0].Controls.Clear();
creatControl(e.Item.Cells[0]);
}
}
protected override void OnItemCommand(DataGridCommandEventArgs e)
{
string strCommandName = e.CommandName;
if(e.CommandName==null)
{
return ;
}
strCommandName = string.IsInterned(strCommandName);
switch(e.CommandName)
{
case "PrevPage":
PrevPage_click(null,null);
break;
case "NextPage":
NextPage_click(null,null);
break;
}
base.OnItemCommand(e);
}
InitDataGrid
InitEvent
GridFunction
Util
}
}
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace DataGrid_itec
{
/// <summary>
/// Summary description for iTECDataGrid.
/// </summary>
[DefaultProperty("Text"),
ToolboxData("<{0}:iTECDataGrid runat=server></{0}:iTECDataGrid>")]
public class iTECDataGrid : System.Web.UI.WebControls.DataGrid
{
Define
DisplayProtery
Proterty
/// <summary>
/// 將此控件呈現給指定的輸出參數
/// </summary>
/// <param name="e">要寫出到的HTML編寫器</param>
protected override void OnItemCreated(DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.Pager)
{
e.Item.Cells[0].Controls.Clear();
creatControl(e.Item.Cells[0]);
}
}
protected override void OnItemCommand(DataGridCommandEventArgs e)
{
string strCommandName = e.CommandName;
if(e.CommandName==null)
{
return ;
}
strCommandName = string.IsInterned(strCommandName);
switch(e.CommandName)
{
case "PrevPage":
PrevPage_click(null,null);
break;
case "NextPage":
NextPage_click(null,null);
break;
}
base.OnItemCommand(e);
}
InitDataGrid
InitEvent
GridFunction
Util
}
}