zoukankan      html  css  js  c++  java
  • Gridview 行变色和行按钮调用前端js

    1.鼠标移动某一行 ,变色

    protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
    
        {
    
        if (e.Row.RowType == DataControlRowType.DataRow)
    
        {
    
        //鼠标经过时,行背景色变
    
        e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#00A9FF'");
    
        //鼠标移出时,行背景色变
    
        e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'");
      //设置悬浮鼠标指针形状为“下手”
        e.Row.Attributes["style"] = "cursor:pointer"; } }

     

    2.编辑按钮调用前端的js 方法

     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
            {
              //获取gridview里的编辑按钮
                ImageButton buttonE = new ImageButton();
                buttonE = (ImageButton)e.Row.FindControl("IB_Edit");
                
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
             DataRowView drv = (DataRowView)e.Row.DataItem; string SYSID_Floor = drv["SYSID_Meter"].ToString();           //给按钮添加onclick属性,调用前端的js方法 updateNav() buttonE.Attributes["onclick"] = "return UpdateNav(" + SYSID_Floor + ")"; buttonE.CommandName = "Edit"; } }

     前端js

    <script>
    
     function UpdateNav(floorId) {
    
                //iframe层-父子操作
                var index = layer.open({
                    title: "修改接表点信息",
                    type: 2,
                    area: ['700px', '530px'],
                    fix: false, //不固定
                    maxmin: true,
                    content: "ad_meter_detail.aspx?SYSID=" + floorId
                });
                //重新给指定层设定width、top等
                layer.style(index, {
                    top: '15px'
                });
                return false;
    
            }
    </script>
    View Code
  • 相关阅读:
    hdu 2132 An easy problem
    ACM暑假培训宣讲稿
    hdu Lovekey(水题)
    windows 下c++编译
    semantic
    could not open XXX permission denied
    sv_target_output dx11
    hlsl 的tex函数
    effect state dx11
    cg 到hlsl的转换
  • 原文地址:https://www.cnblogs.com/youchim/p/5278540.html
Copyright © 2011-2022 走看看