1
<asp:Repeater ID="rptrParent" runat="server">
<ItemTemplate>
<li>
<a href="<% =ResolveUrl("~/cPanel/UserView.aspx?User=")%><%# Eval("StudentUserName") %>">
<span>
<% ProfileCommon pc = new ProfileCommon();
pc.GetProfile(Eval("StudentUserName").ToString());
Response.Write(pc.FirstName + "" + pc.LastName);
%>
</span>
</a>
</li>
</ItemTemplate>
以下错误
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
上这部分
<% ProfileCommon pc = new ProfileCommon();
pc.GetProfile(Eval("StudentUserName").ToString());
Response.Write(pc.FirstName + "" + pc.LastName);
%>
@The岩:ASP.Net的'Eval'不是你想象的那样。 – SLaks 2010-04-20 02:31:01
你得到的错误是什么? – Luis 2010-04-20 02:31:52
嘿家伙,我知道我可以使用 <%#Eval(“StudentUserName”)%> 我想获得用户的配置文件的名字和姓氏与它一起打印。 – Maverick 2010-04-20 02:45:17