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