让DataGrid不激发验证
1 private void dgwfl_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
2 {
3 if(e.Item.ItemIndex>=0)
4 {
5 LinkButton lb = (LinkButton)e.Item.Cells[0].Controls[0];
6 lb.CausesValidation=false;
7 }
8
9 }
2 {
3 if(e.Item.ItemIndex>=0)
4 {
5 LinkButton lb = (LinkButton)e.Item.Cells[0].Controls[0];
6 lb.CausesValidation=false;
7 }
8
9 }
PS:Cells[0]为编辑所在的列,Controls[0]为该单元里的第一个控件.