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

  • 相关阅读:
    一对一关联
    一对多关联
    软删除
    分层控制器
    系统的助手函数
    tp5命令行基础介绍
    PHP 开启跨域
    生成数据库模型文件
    REST API 安全设计指南
    jquery-Ajax请求用例码
  • 原文地址:https://www.cnblogs.com/ltjabc/p/214647.html
Copyright © 2011-2022 走看看