如何实现:用鼠标点击datagrid某一个单元格(或者是这个单元格旁边绑定的按钮),这时候弹出一个新的窗口,新窗口没有菜单项,大小可以自己设定,原来单元格中的内容在新窗口中显示出来,同时可以对显示出来的内容进行修改。

解决方案 »

  1.   

     #region[GV_Customer行加载事件]
        //GV_Customer行加载事件
        protected void GV_Customer_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //当鼠标停留时更改背景色
                e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#E6E6FA'");
                //当鼠标移开时还原背景色
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
                //鼠标双击事件
                e.Row.Attributes.Add("ondblclick", "self.location='Customer_Register.aspx?CustID="
                    + GV_Customer.DataKeys[e.Row.RowIndex].Value.ToString() + "'");
            }
        }
        #endregion
    我这是吧值传到一个页面
    你如果想弹出窗口的话,可以把self.location改成
    window.open('Customer_Register.aspx?CustID="
                    + GV_Customer.DataKeys[e.Row.RowIndex].Value.ToString() + "','','height=550, width=850, top=100, left=100, toolbar=no,  menubar=no, scrollbars=no, resizable=yes,location=no, status=no');
      

  2.   

    这个是vs2005中,如果是在vs2003中如何实现呢
      

  3.   

    我一般是这么做的,在GV下面(或右边)单独做个可修改的详细信息表单, 单击某一行时显示详细信息再修改. 类似于在VS03或05中单击某个控件在右边显示属性那种效果. 我觉得这是比较合理的做法.不要老想着弹出窗口. 现在很多浏览器和所谓的助手都自动拦截. 不管是在浏览器中还是在客户端软件中,弹出窗口都越来越不受欢迎了.