还是传值问题
protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { // bind(); bindDT(); if (Request.QueryString["zid"] != null) { int zid = Convert.ToInt32(Request.QueryString["zid"].ToString()); DataTable dt2 = Bmer.GetFMSbyid(zid).Tables[0]; this.Repeater2.DataSource = dt2; this.Repeater2.DataBind(); } if(Request.QueryString["notid"]!=null) { int notid = Convert.ToInt32(Request.QueryString["notid"].ToString()); this.GridView3.DataSource = Bmer.GetPyByid(notid).Tables[0]; this.GridView3.DataBind(); } } } private void bindDT() { DataTable dt = Bmer.GetAllname().Tables[0]; this.Repeater1.DataSource = dt; this.Repeater1.DataBind(); }
<div> <asp:Repeater ID="Repeater1" runat="server"> <HeaderTemplate><table border="1"><tr><td>比赛名称</td></HeaderTemplate> <ItemTemplate> <td> <a href='Default.aspx?zid=<%#Eval("zid") %>'> <%#Eval("zname")%> </a> </td> </ItemTemplate> <FooterTemplate></tr></table></FooterTemplate> </asp:Repeater> <br /> <br /> <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"> <Columns> <asp:BoundField DataField="id" HeaderText="id" Visible="False" /> <asp:BoundField DataField="name" HeaderText="比赛名称" /> <asp:BoundField DataField="zid" HeaderText="zid" Visible="False" /> </Columns> </asp:GridView> <asp:Repeater ID="Repeater2" runat="server"> <HeaderTemplate><table border="1"><tr><td>分类比赛</td></HeaderTemplate> <ItemTemplate> <td><a href='Default.aspx?notid=<%#Eval("notid") %>'> <%#Eval("name")%> </a> </td> </ItemTemplate> <FooterTemplate></tr></table></FooterTemplate> </asp:Repeater> <br /> <br /> <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False"> <Columns> <asp:BoundField DataField="id" HeaderText="id" Visible="False" /> <asp:BoundField DataField="name" HeaderText="选手" /> <asp:BoundField DataField="notid" HeaderText="notid" Visible="False" /> </Columns> </asp:GridView> <br /> <br /> </div>