Dynamically Generated Dropdown gets Cleared
I have a dynamicly generated dropdown list that keeps getting cleared when plugged into Sitefinity. I am using it inside a control. When I register the control outside of sitefinity it works fine but inside of sitefinity it gets reset before my submit button click event takes effect.
Dim year As Integer
For year = System.DateTime.Now.Year To System.DateTime.Now.Year + 7
cboExpirationYear.Items.Add(year.ToString)
Next
Essentially it i were to select 2018 and click submit and have the click event display the year it displays 2011.
Any help would be appreciated.
Lonnie
Have you enabled viewstate on the page? I think it's a checkbox on the page properties
I BELIEVE by default viewstate is off (which is a good thing)
Hello Steve and Lonnie,
Yes, view state is disabled by default so you should enable it for this page. Otherwise data in such drop downs will be lost between page postbacks.
Regards,