【发布时间】:2015-09-21 13:31:28
【问题描述】:
我尝试将一些文本标签从 db 传递到中继器内的用户控件,但没有任何成功。它似乎没有传递我的变量。
例如查看折扣变量
我的 Default.cs:
public String strDiscount { get; set; }
...
strDiscount = getCaptionFromDB("strDiscount");
我的默认.aspx:
<asp:Repeater ItemType="MyProduct" ID="ProductsGrid" runat="server">
<ItemTemplate>
<uc1:productRow runat="server" Item="<%#Item%>" strDiscount="<%#strDiscount%>" />
</ItemTemplate>
</asp:Repeater>
我的产品用户控制:
public partial class Product : System.Web.UI.UserControl {
public String strDiscount { get; set; }
protected void Page_Load(object sender, EventArgs e) {
...
}
我的 ProductRow 用户控件 ascx.cs:
public partial class ProductRow : Product {
}
我的 ProductRow 用户控件 ascx:
...
<%:Item.BonusGetValue%>% <%:strDiscount %>
...
我一定做错了什么,但我不知道是什么。 提前致谢
【问题讨论】: