I created a user control. It contains the public property "CurrentValue". When I try to initialize a property using an Eval expression, a value of zero is assigned.
// In the code below, label assignment is OK, assigning a RatingNull control gets zero
<asp:TemplateField> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Eval("Difficulty") %>' <uc1:RatingNull ID="RatingNull1" runat="server" CurrentValue='<%# Eval("Difficulty") %>' /> </ItemTemplate>
If I directly assigned a value (that is, CurrentValue = "5"), user control is working fine.
public partial class RatingNull : System.Web.UI.UserControl { private string _CurrentValue; public string CurrentValue { get { return _CurrentValue; } set { _CurrentValue = value; } } (...) }
source share