Dynamically Generated Dropdown gets Cleared

Posted by Community Admin on 04-Aug-2018 14:36

Dynamically Generated Dropdown gets Cleared

All Replies

Posted by Community Admin on 19-Oct-2011 00:00

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

Posted by Community Admin on 19-Oct-2011 00:00

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)

Posted by Community Admin on 21-Oct-2011 00:00

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,
Lubomir Velkov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed