功能很简单:就是点击列表中的一条记录,弹出一个新的web窗体,显示该单子的明细,
查了几个帖子,说了需要结合JavaScript来做,但是没有说如何在处理代码中获取JavaScript所获取的记录信息,我刚入门,希望大家能给一个完整的过程谢谢。
没分了,是在对不住啊。

解决方案 »

  1.   

    就是一个双击事件吗?页面用(window.ShowModalDialog)弹出后返回一个值给父页面就好了啊!
      

  2.   

    在给gridview邦定记录的时候给每一行添加onclick事件的,
    string id = "";
    e.Row.Attributes.Add("onclick", "showDetail('"+id+"');");前台加个showDetail的函数的
    function showDetail(id)
    {
    window.showDialog("detail.aspx?id" + id);
    }
      

  3.   

    用HyperlinkField列也可以实现你的功能,将girdview中的列设为以下格式:
    <asp:HyperLinkField DataNavigateUrlFormatString="~/detail/detDetailAll.aspx?programerID={0}&amp;openFlag=0" DataTextField="programerName" HeaderText="课题名称" SortExpression="programerName" DataNavigateUrlFields="programerID" >
    <ItemStyle HorizontalAlign="Left" />
    </asp:HyperLinkField>
      

  4.   

        protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            //为表格添加数字列
            if (e.Row.RowIndex != -1)
            {
                int id = e.Row.RowIndex + 1;
                e.Row.Cells[0].Text = id.ToString();
            }        if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //添加删除确认
                ((LinkButton)(e.Row.Cells[3].Controls[0])).Attributes.Add("onclick", "return confirm('确定删除数据吗?')");
                ((LinkButton)(e.Row.Cells[9].Controls[0])).Attributes.Add("onclick", "return confirm('确定永久删除数据吗?')");            //鼠标经过表格行改变颜色            e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='orange';this.style.color='buttontext';this.style.cursor='default';");
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='';this.style.color='';");            //鼠标双击跳转到编辑页面            e.Row.Attributes.Add("ondblclick", "[location.href='DepartmentAdd.aspx?TYPE=VIEW&ID=" + e.Row.Cells[4].Text + "']此处改成你要的操作并把ID传进去不就行了吗");
            }
        }
      

  5.   

    在GridView中定义双击的js函数,如下:
        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("ondblclick", "test("+e.Row.RowIndex.ToString()+")");
            }
        }js:
            function test(n) {
                alert(n);//获得点击的行数
                  .....................
            }
      

  6.   

    protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            //为表格添加数字列
            if (e.Row.RowIndex != -1)
            {
                int id = e.Row.RowIndex + 1;
                e.Row.Cells[0].Text = id.ToString();
            }        if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //添加删除确认
                ((LinkButton)(e.Row.Cells[3].Controls[0])).Attributes.Add("onclick", "return confirm('确定删除数据吗?')");
                ((LinkButton)(e.Row.Cells[9].Controls[0])).Attributes.Add("onclick", "return confirm('确定永久删除数据吗?')");            //鼠标经过表格行改变颜色            e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='orange';this.style.color='buttontext';this.style.cursor='default';");
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='';this.style.color='';");            //鼠标双击跳转到编辑页面            e.Row.Attributes.Add("ondblclick", "[location.href='DepartmentAdd.aspx?TYPE=VIEW&ID=" + e.Row.Cells[4].Text + "']此处改成你要的操作并把ID传进去不就行了吗");
            }
        }
      

  7.   

    e.Row.Attributes.Add("ondblclick", "[location.href='DepartmentAdd.aspx?TYPE=VIEW&ID=" + e.Row.Cells[4].Text + "']此处改成你要的操作并把ID传进去不就行了吗");谢谢楼上,请问如果要弹出新页面,并给新页面中的三个label赋值(对应GridView的3个字段),该如何做呢?
      

  8.   

    呵呵,能想来,我自己都觉得有些无奈,不过确实不理解。
    以前一直用Delphi,最近才学习web开发,很多地方脑子都转不过来,大家见笑了
    不过笑归笑,还望帮在下解决问题啊,呵呵
      

  9.   

    说实话,我也是初学者,又那么巧我完成了上面的功能。因为不方便贴代码。以下列出一些关键字,你可以去搜索下,网上都是现成的。
    1、首先构造能传送的id,获取id,然后弹出页面。
    你可以参考4楼的说法,这里面涉及到window.ShowModalDialog 的用法,至于你说的要带3个参数,这里可以用session的方法也可以用地址带参数的方法(比如www.abc.com/a.aspx?a=1&b=2&c=3)
    2、然后弹出的的页面获取参数
    如果用session的方法就是HttpContext.Current.Session["a"].ToString.Trim()
    如果是用参数的方法就是HttpContext.Current.QueryString["id"]
    3、至于赋值嘛?
    label1.text = a这个应该没什么问题吧?大概方法是如此了,看上去挺简单,不过如果不懂得话还是逐个击破难点吧。GL
      

  10.   

    你可能会用到的一些搜索关键字,其实很多问题网上都有现成的了,只是看你如何搜索而已,实在没有再来提问吧,
    window.ShowModalDialog
    session
    网页 传递参数
    js
    gridview 获取点击行 id
      

  11.   

    在GridView的RowDataBound事件中
    e.Row.Attributes.Add("onclick", "弹窗函数");