datagrid 翻页前能不能先执行一段js脚本
用for或foreach,放到if(e.Item.ItemType==ListItemType.Pager)里面
private void DataGrid1_ItemCreated(object sender, DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.Pager)
{
for(int i=0;i<e.Item.Cells[0].Controls.Count;i++)
{
if(e.Item.Cells[0].Controls[i] is LinkButton)
{
((LinkButton)e.Item.Cells[0].Controls[i]).Attributes.Add("onclick","return test(););
}
}
}
}
js脚本
function test()
{
alert('Input page must format as integer.');
}
----------------------------------
http://topic.csdn.net/t/20060216/16/4559960.html
private void DataGrid1_ItemCreated(object sender, DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.Pager)
{
for(int i=0;i<e.Item.Cells[0].Controls.Count;i++)
{
if(e.Item.Cells[0].Controls[i] is LinkButton)
{
((LinkButton)e.Item.Cells[0].Controls[i]).Attributes.Add("onclick","return test(););
}
}
}
}
js脚本
function test()
{
alert('Input page must format as integer.');
}
----------------------------------
http://topic.csdn.net/t/20060216/16/4559960.html