Problem Exposing Property?
I have a Web User Control for year, since I will want it to update in the future to include the current year. It contains years from 1970 to the current year.
The Web User Control will be used in a FormView for the EditItemTemplate. I want to be able to use the SelectedValue property to select the item that is bound to the database.
No errors appear, but the SelectedValue is not set to the correct year stored in the DB. Can anyone tell me what I'm doing wrong?
Thanks so much in advance!
Here is the code.
In EditItemTemplate, the included User Control:
<uc1:WUC_DDLYear ID="WUC_DDLYearResolution" runat="server" SelectedValue='<%# year(Eval("Resolution")) %>' />
The User Control Source:
<asp
ropDownList ID="DDLYear" runat="server">
</asp
ropDownList>
The User Control Code:
Public Partial Class WUC_DDLYear
Inherits System.Web.UI.UserControl
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim thisYear As Integer
For thisYear = 1970 To Year(Now())
DDLYear.Items.Add(thisYear)
Next
End Sub
Public Property DDLSelectedValue() As String
Get
Return DDLYear.SelectedValue
End Get
Set(ByVal value As String)
DDLYear.SelectedValue = value
End Set
End Property
End Class
Any help is very much appreciated!