这个简单,你做一个链接列,在链接列的URL指定Message.aspx?ID={0},并指定绑定的字段为员工的ID

解决方案 »

  1.   

    只要把选中的列的参数传给另外的web页
      

  2.   

    点击详细信息按钮的事件中:
    Page.RegisterStartupScript ("mywindow","<script language=javascript>window.open('详细信息URL?ID="+DataGrid中被选行的记录ID+"','mywindow','width=232,height=250,left=8,top=8,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no, alwaysRaised')</script>");在详细信息页中
    显示ID=Request.QueryString["ID"]的详细信息。
      

  3.   

    点击详细信息按钮的事件中:
    Page.RegisterStartupScript ("mywindow","<script language=javascript>window.open('详细信息URL?ID="+DataGrid中被选行的记录ID+"','mywindow')</script>");在详细信息页中
    显示ID=Request.QueryString["ID"]的详细信息。
      

  4.   

    你可以在datagrid1中定义一个模版列,在该列中加入一个按钮button1
    然后在datagrid1_dataitembound事件中:实例化这个按钮
     Button btn=(Button)e.item.cell[模版列索引号].findcontrol("button1");
     btn.commandargument=员工的编号(就是能唯一确定员工的一个辆);
    在datagrid1_itemcommand事件中
    string id=e.commandargument.tostring();
    然后调用javascript脚本的windows.open()方法打开一个新页,同时将那个员工id做为参数传递就可以了
      

  5.   

    你选中DATAGRID控件,右击到属性生成器里有一个链接列,你生成一个,下面可以设定参数
      

  6.   

    在详细信息页中
    显示ID=Request.QueryString["ID"]的详细信息。怎么做啊??是不是能获得id的值?
      

  7.   

    可以获得id的值呀。web2.aspx?id=...就可以。
    要不就定义个public static变量也可以
      

  8.   

    http://chs.gotdotnet.com/quickstart/aspplus/doc/webdataaccess.aspx#masterdetail
      

  9.   

    Re:怎么接收参数啊??  Request.QueryString["id"]
    楼上的几位方法都可以实现。
      

  10.   

    id 是个变量,怎么进行查询啊??
    SqlDataAdapter sqladp=new SqlDataAdapter ("select *from 职工信息表 where 代号=ID",conn);明显不行啊,请大家帮忙,很菜了,呵呵!!
      

  11.   

    就用平凡的程序员简单的方法好啊这个简单,你做一个链接列,在链接列的URL指定Message.aspx?ID={0},并指定绑定的字段为员工的ID
      

  12.   

    给你一个MSDN中的例子:运行后双击某一行。
    <%@ Page Language="C#" %>
    <%@ Import Namespace="System.Data" %>
     
    <html>
    <script runat="server">
     
       ICollection CreateDataSource() 
       {
          DataTable dt = new DataTable();
          DataRow dr;
     
          dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32)));
          dt.Columns.Add(new DataColumn("StringValue", typeof(string)));
          dt.Columns.Add(new DataColumn("CurrencyValue", typeof(double)));
     
          for (int i = 0; i < 5; i++) 
          {
             dr = dt.NewRow();
     
             dr[0] = i;
             dr[1] = "Item " + i.ToString();
             dr[2] = 1.23 * (i+1);
     
             dt.Rows.Add(dr);
          }
     
          DataView dv = new DataView(dt);
          return dv;
       }
     
       void Page_Load(Object sender, EventArgs e) 
       {
     
          if (!IsPostBack) 
          {
             // Load this data only once.
             ItemsGrid.DataSource = CreateDataSource();
             ItemsGrid.DataBind();
          }
     
       }
     
       void Item_Bound(Object sender, DataGridItemEventArgs e) 
       {      ListItemType itemType = (ListItemType)e.Item.ItemType;      if ((itemType != ListItemType.Header) &&
              (itemType != ListItemType.Footer) &&
              (itemType != ListItemType.Separator))
          {         // Get the IntegerValue cell from the grid's column collection.
             TableCell intCell = (TableCell)e.Item.Controls[0];         // Add attributes to the cell.
             intCell.Attributes.Add("id", "intCell" + e.Item.ItemIndex.ToString());
             intCell.Attributes.Add("OnClick", 
                                    "Update_intCell" + 
                                    e.Item.ItemIndex.ToString() + 
                                    "()");         // Add attributes to the row.
             e.Item.Attributes.Add("id", "row" + e.Item.ItemIndex.ToString());
             e.Item.Attributes.Add("OnDblClick", 
                                    "Update_row" + 
                                    e.Item.ItemIndex.ToString() + 
                                    "()");
             
          }
     
       }
     
    </script><script language="vbscript">   sub Update_intCell0 
          Alert "You Selected Cell 0."
       end sub   sub Update_intCell1 
          Alert "You Selected Cell 1."
       end sub   sub Update_intCell2 
          Alert "You Selected Cell 2."
       end sub   sub Update_intCell3 
          Alert "You Selected Cell 3."
       end sub   sub Update_intCell4 
          Alert "You Selected Cell 4."
       end sub   sub UpDate_row0 
          Alert "You selected the row 0."
       end sub   sub UpDate_row1 
          Alert "You selected the row 1."
       end sub   sub UpDate_row2 
          Alert "You selected the row 2."
       end sub   sub UpDate_row3 
          Alert "You selected the row 3."
       end sub   sub UpDate_row4 
          Alert "You selected the row 4."
       end sub   </script>
     
    <body>
     
       <form runat=server>      <h3>
                Adding Attributes to the &lt;td&gt; and &lt;tr&gt; <br>
                Tags of a DataGrid Control
          </h3>
     
          <asp:DataGrid id="ItemsGrid" runat="server"
               BorderColor="black"
               BorderWidth="1"
               CellPadding="3"
               ShowFooter="true"
               OnItemDataBound="Item_Bound"
               AutoGenerateColumns="false">         <HeaderStyle BackColor="#00aaaa">
             </HeaderStyle>         <FooterStyle BackColor="#00aaaa">
             </FooterStyle>         <Columns>            <asp:BoundColumn HeaderText="Number" 
                     DataField="IntegerValue">               <ItemStyle BackColor="yellow">
                   </ItemStyle>
     
                </asp:BoundColumn>            <asp:BoundColumn
                     HeaderText="Item" 
                     DataField="StringValue"/>            <asp:BoundColumn 
                     HeaderText="Price" 
                     DataField="CurrencyValue" 
                     DataFormatString="{0:c}">               <ItemStyle HorizontalAlign="right">
                   </ItemStyle>
       
                </asp:BoundColumn>         </Columns>
       
          </asp:DataGrid>      <br><br>      Click on one of the cells in the <b>Number</b> column to select the cell.      <br><br>      Double click on a row to select a row.   
     
       </form>
     
    </body>
    </html>