datagrid的分页想用第x页来表示或者翻页的时候来提示,解决办法:
private void DataGrid1_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.Pager)
{
foreach(Control c in e.Item.Controls[0].Controls)
{
if(c.GetType().ToString()=="System.Web.UI.WebControls.DataGridLinkButton")
{
LinkButton lb=(LinkButton)c;
lb.Attributes.Add("onclick","return confirm('really?');");
}
}
}
}
可以写lb.Text="第"+lb.Text+"页"; {
if(e.Item.ItemType==ListItemType.Pager)
{
foreach(Control c in e.Item.Controls[0].Controls)
{
if(c.GetType().ToString()=="System.Web.UI.WebControls.DataGridLinkButton")
{
LinkButton lb=(LinkButton)c;
lb.Attributes.Add("onclick","return confirm('really?');");
}
}
}
}