repeater下绑定了hyperlink,最后一项绑定不了链接,求解释
前台代码
<asp:Repeater ID="repArea" runat="server" onitemdatabound="repArea_ItemDataBound">
<ItemTemplate>
<li>
<asp:HiddenField ID="hid_area" runat="server" Value='<%# Eval("areaID") %>' />
<asp:HyperLink ID="linkarea" runat="server"><%# Eval("areaName") %></asp:HyperLink>
</li>
后台代码:
private void BindRepArea()
{
BLL.area bll = new BLL.area();
repArea.DataSource = bll.GetList("");
repArea.DataBind();
}
for (int i = 0; i < repArea.Items.Count; i++)
{
HyperLink link = repArea.Items[i].FindControl("linkarea") as HyperLink;
HiddenField hid = repArea.Items[i].FindControl("hid_area") as HiddenField;
link.NavigateUrl = "market.aspx?class=" + str + "&area=" + hid.Value;
}
------解决方案--------------------