EVAL在C#中asp.net
问题描述:
我已经放在绑定到一个DataSource对象一个DataList内容占位符的动态内容。问题是我需要检查EVAL的价值。这里是code:
i have dynamic content in a content placeholder placed in a datalist that is bound to an object datasource. the problem is i need to check the value of the EVAL. here is the code:
<asp:DataList ID="DataList1" runat="server" CellPadding="4"
DataSourceID="ObjectDataSource1" ForeColor="#333333">
<AlternatingItemStyle BackColor="White" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<ItemStyle BackColor="#EFF3FB" />
<ItemTemplate>
<a href="<%# Eval("VendorLink") %>"> <%# Eval("Vendor") %></a>
<br />
<a href="<%# Eval("TitleLink") %> "><%# Eval("Title") %></a>
<br />
<asp:Label ID="DescLabel" runat="server" Text='<%# Eval("Desc") %>' />
<br />
<asp:Label ID="DetailsLabel" runat="server" Text='<%# Eval("Details") %>' />
<br />
<asp:Label ID="RptIDLabel" runat="server" Text='<%# Eval("RptID") %>' />
<br />
<asp:Label ID="LinksLabel" runat="server" Text='<%# Eval("Links") %>' />
<br />
<br />
</ItemTemplate>
<SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
</asp:DataList>
我想说
<%if(Eval("RptID") =="SomeString") { Eval("rtpid") = "Pass");}%>
我需要的检查是在aspx页面,而不是aspx.cs页面!如何进行检查?
i need the checkup to be at the aspx page and not the aspx.cs page! how to perform the checkup??
答
您可以检查象下面这样:
You can check like below :
<%# Eval("VenderLink") == "somestring" ? "p %>