zoukankan      html  css  js  c++  java
  • 为DataGrid行添加事件

    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?');");
            }
    }

  • 相关阅读:
    DC中为什么要用Uniquify?
    hdu 1596 find the safest road
    hdu2112 HDU Today
    hdu 2066 一个人的旅行
    poj 3026 Borg Maze
    poj 1979 Red and Black
    poj 1321 棋盘问题
    hdu 1010 Tempter of the Bone
    hdu 4861 Couple doubi
    codeforces584B Kolya and Tanya
  • 原文地址:https://www.cnblogs.com/ltjabc/p/214647.html
Copyright © 2011-2022 走看看