已知一个Gridview
里面有多个列
多条记录比如其中一个列是 col1
如何点击这个列上的 具体一个记录 比如说这个记录为A
弹出新的窗口并且这个新的窗口也是一个Gridview
这里查询显示一个与记录A 相关的一组数据

解决方案 »

  1.   


      protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    int count = GridView1.Rows.Count;
                    for (int i = 0; i < count; i++)
                    {
                        ID = GridView1.DataKeys[i].Value.ToString(); GridView1.Rows[i].Attributes.Add("ondblclick", "window.open('xxx.aspx')");                }
                }
            }
      

  2.   

    曾经做过练习,建议你使用usercontrol自定义控件来扩展GRIDVIEW属性,很简单的,研究一下
      

  3.   

    获得这个Id后通过Request.QueryString传给另一个GridView所在的页面接收
      

  4.   

     <asp:TemplateField  HeaderText="标  题">
     <ItemStyle HorizontalAlign ="Center" /> <ItemTemplate><a href="javascript:open('<%#Eval("Id")%>');">
    <%#Eval("Subject")%></a>
    </ItemTemplate>
    </asp:TemplateField>
     function open(Id) {         URL = "a.aspx?Id=" + Id;
             myleft = (screen.availWidth - 500) / 2;
             window.open(URL, "", "height=500,width=550,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top=100,left=" + myleft + ",resizable=yes");
         }
      

  5.   

     <asp:TemplateField  HeaderText="标  题">
     <ItemStyle HorizontalAlign ="Center" /> <ItemTemplate><a href="javascript:open('<%#Eval("Id")%>');">
    <%#Eval("Subject")%></a>
    </ItemTemplate>
    </asp:TemplateField>
     function open(Id) {         URL = "a.aspx?Id=" + Id;
             myleft = (screen.availWidth - 500) / 2;
             window.open(URL, "", "height=500,width=550,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top=100,left=" + myleft + ",resizable=yes");
         }
      

  6.   

    有没有会啊要windows窗口程序操作哈
      

  7.   

    GRIDVIEW 有一个链接列有来做.
      

  8.   

    应该是行吧?
    思路:
    ①获取点击的ID
    ②获取各列信息到一个表中
    ③用属性传递参数到另一个gridview进行数据绑定
      

  9.   

    可以用hylink超链传个主键参数过去,在下一个页面的后台进行查询那条记录的信息,然后fill给gridview
      

  10.   

    给你个例子吧 
    private void dgSet_CellClick(object sender, DataGridViewCellEventArgs e)
            {
                if (dgSet.DataSource != null && dgSet.Rows.Count > 0)
                {
                    if (e.RowIndex != -1)
                    {
                        string id = dgSet.Rows[e.RowIndex].Cells[0].Value.ToString();
                        然后show一个新页面,将这个id传过去,并根据id查询信息
                    }
                }
            }