首页 > 应用开发 > IT综合 > ASP.NET中的DataGrid的属性 (转)
////////////////分页处理程序;
void Page_Load(object sender, EventArgs e)
{
if (CheckBox1.Checked)
ItemsGrid.PagerStyle.Mode=PagerMode.NumericPages;
else
ItemsGrid.PagerStyle.Mode=PagerMode.NextPrev;
if (!IsPostBack)
{
start_index = 0;
ItemsGrid.VirtualItemCount=100;
}
BindGrid();
}
/////////////邦定公用函数;
void BindGrid()
{
ItemsGrid.Datasource=CreateDataSource();
ItemsGrid.DataBind();
}
///////////////////////// 数据库的链 接在前面已经发表过的,!
<ASP:DataGrid id="ItemsGrid" runat="server"
BorderColor="black"
BorderWidth="1"
CellPadding="3" //行间隔;
AllowPaging="true" //换页开关;
AllowCustomPaging="true" //
BackImageUrl="Imagesimage1.jpg" //背景图象;
AutoGenerateColumns="false" //改变属性数据格会不一样有:true & false;
OnPageIndExchanged="Grid_Change"> //分页驱动程序ID
//分页默认样式;
Position="Bottom"
PageButtonCount="5"
BackColor="#00aaaa">
DataField="StringValue"/>
DataField="CurrencyValue"
DataFormatString="{0:c}">
//选择数字显示分页
AutoPostBack="true"
runat="server"/>
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10748419/viewspace-976158/ ,如需转载,请注明出处,否则将追究法律责任。