private void grid_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
  {
   if(e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Footer )
   {
    e.Item.Attributes.Add("onmouseover","this.setAttribute('BKC',this.style.backgroundColor);this.style.backgroundColor='#FF0000'");
    e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=this.getAttribute('BKC');");


   }

  }


private void OnItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
   {
        
if(e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Footer )
        {
            LinkButton btnSave 
= (LinkButton)e.Item.Cells[2].Controls[0];
      string strClientID 
= btnSave.ClientID; //得到该控件的客户端ID,可供JavaScript调用
            btnSave.Attributes.Add("onclick","Javascript:return confirm('Are you sure to save?');");
        }
}

相关文章:

  • 2021-09-23
  • 2021-06-03
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
  • 2021-09-02
  • 2021-12-20
猜你喜欢
  • 2022-02-24
  • 2022-01-16
  • 2021-07-31
  • 2022-02-25
  • 2021-09-09
  • 2021-12-27
相关资源
相似解决方案