假如这个超级连接列有个值1,要把1传到被转向的下一页,如何传?
Session["Number"]=?如何写?
应该在DATAGRID的什么事件内写代码?

解决方案 »

  1.   

    ItemCommand事件里面写:
    e.Item.Cells[0].Text;
      

  2.   

    脚本代码
    <asp:ButtonColumn DataField="ID" HeaderText="序号" CommandName="ShowID">
    <HeaderStyle Width="6%"></HeaderStyle>
    </asp:ButtonColumn>
    后台代码
    private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    if(e.CommandName=="ShowID")
    Response.Redirect("Newpage.aspx?ID="+e.Item.Cells[0].Text);
    }
      

  3.   

    <asp:DataGrid id="MyDataGrid" 
               BorderColor="black"
               BorderWidth="1"
               GridLines="Both"
               AutoGenerateColumns="false"
               runat="server">         <HeaderStyle BackColor="#aaaadd"/>         <Columns>            <asp:HyperLinkColumn
                     HeaderText="Select an Item"
                     DataNavigateUrlField="IntegerValue"
                     DataNavigateUrlFormatString="detailspage.aspx?id={0}"
                     DataTextField="PriceValue"
                     DataTextFormatString="{0:c}"
                     Target="_blank"/>
               
             </Columns>      </asp:DataGrid>