在GRIDVIEW里面,我现在想双击得到选中这行的内容,并到达下一个页面(详细页面),怎么做啊
要详细的.........

解决方案 »

  1.   

    可参看:http://www.it55.com/html/xueyuan/chengxukaifa/_NETjiaocheng/20071021/253036.html
      

  2.   


    Page1.aspx
    protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        Response.Redirect("Page2.aspx?ID=" + e.NewEditIndex);//e.NewEditIndex绑定反点击的行所显示的信息
    }本页的GridView和Page2.aspx中的FormView用同样的数据进行绑定
    Page2.aspx
    protected void Page_Load(object sender, EventArgs e)
    {
        int Index = int.Parse(Request["ID"].toString());
        fvAutomobile.ChangeMode(FormViewMode.Edit);//更改FormView的显示模板为编辑模板
        fvAutomobile.PageIndex = Index;//绑定反点击的行所显示的信息
        //e.Cancel = true;
    }
      

  3.   

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            { 
                DataRowView drv = (DataRowView)e.Row.DataItem;
                e.Row.Attributes["ondblclick"] = "location.href='details.aspx?id=" + drv["字段名"] + "'";
            }
        }
      

  4.   

    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    e.Row.Attributes.Add("ondblclick", "javascript:OpenDetail(this)");
                }
            }js:
    function OpenDetail(obj)
        {
            window.open("url?ID="+obj.cells[2].innerHTML);
        }
    url 是你详细页面。
      

  5.   

     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            int index;        if (e.Row.RowType == DataControlRowType.DataRow)
            {
                index = e.Row.RowIndex;
                           for (int i = 1; i < e.Row.Cells.Count; i++)
                {
                    string str = e.Row.Cells[1].Text.ToString();
                    e.Row.Cells[i].Attributes["onMouseover"] = "this.style.cursor='hand'";
                    e.Row.Cells[i].Attributes["onClick"] = "window.open('GGdetails.aspx?title="+str+"','','width=600px,height=400px,top=250px,left=350px')";
                }
            }
        }