62,266
社区成员
发帖
与我相关
我的任务
分享
aspx页面:
<asp:Repeater ID="rpt1" runat="server" onitemdatabound="rpt1_ItemDataBound">
<ItemTemplate>
<% if (1>1) {%>
<tr><td>
<%# Eval("Name") %>
</td></tr>
<%} %>
</ItemTemplate>
</asp:Repeater>
.CS页面:
protected void rpt1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
DataBoundLiteralControl control = e.Item.Controls[0] as DataBoundLiteralControl;
string text=control.Text;
}
<% if (1 > 1)
{%>
<%= Test()%>
<%} %>
public string Test()
{
string StrTest = "aaa";
return StrTest;
}