弹出窗口并关闭自身,同时传递多个值给父窗口。

  
  protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string s = "window.opener.document.getElementById('ctl00_MainContent_TextBox1').value='" + e.Row.Cells[0].Text + "';";
            string s1 = "window.opener.document.getElementById('ctl00_MainContent_TextBox2').value='" + e.Row.Cells[1].Text + "'; window.close();";
            e.Row.Attributes.Add("ondblclick", s+s1);//双击选择
            //当鼠标移到的时候设置该行颜色为"", 并保存原来的背景颜色
            e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#C0C0FF';this.style.cursor='hand';");
            //当鼠标移走时还原该行的背景色
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor");
        }
    }

注意,先要判断是否数据行,再进行string的赋值,否则会出现 指定的参数已超出有效值的范围 的错误提示。

转载于:https://www.cnblogs.com/zhenshiruwo/archive/2008/01/31/1060331.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值