repeater应用的问题
在repeater 里面放了一个HyperLink2,,后台代码里面是认不到的,,请问各位高手类似问题怎么解决
前台代码:
<body>
<form id="form1" runat="server">
<div>
<asp:HyperLink ID="HyperLink1" runat="server" Height="27px" Width="81px">HyperLink</asp:HyperLink>
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<table>
<tr>
<td>
<%#Eval("lhttp") %> <%#Eval("lpath") %>
<asp:HyperLink ID="HyperLink2" runat="server">HyperLink</asp:HyperLink>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
</div>
</form>
</body>
后台代码:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
getcon gh = new getcon();//是我自定义一个类
DataSet o = gh.GetConnString("select * from httplogo order by id","httplogo");类里的方法,返回是一个dataset
Repeater1.DataSource = o;
Repeater1.DataBind();
DataRowView my = o.Tables["httplogo"].DefaultView[0];
HyperLink1.ImageUrl =Convert.ToString(my.Row["lpath"]);
HyperLink1.NavigateUrl = Convert.ToString(my.Row["Lhttp"]);
HyperLink2.ImageUrl = Convert.ToString(my.Row["lpath"]);
HyperLink2.NavigateUrl = Convert.ToString(my.Row["Lhttp"]);
}
}
问题:当前上下文找不到"HyperLink2"
[[it] 本帖最后由 willam 于 2008-2-1 17:50 编辑 [/it]]