GridView中超链接HyperLinkField标签的使用方法
这里是前段的asp.net页面
<asp:GridView ID="gvData" runat="server" AutoGenerateColumns="False" DataKeyNames="id"
Width="99%" Css
RowStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center"
onrowdatabound="gvData_RowDataBound">
<Columns>
<asp:BoundField DataField="id" HeaderText="ID" ItemStyle-Width="30px" />
<asp:HyperLinkField DataNavigateUrlFields="id" DataNavigateUrlFormatString="ssRptdetail.aspx?id={0}" DataTextField="dh" HeaderText="单号" />
</Columns>
</asp:GridView>
ssRptdetail.aspx 表示:点击一下具体的单号值,跳转到与之关联的下一个页面!
跳转后页面的C#后台
public partial class shouhou_ssRptdetail : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//取上个页面中传过来的值ID
String id = Request.QueryString["id"];
setData(id);
}
}
protected void setData(String id)
{
.........
}
}