I have an ASP.NET ListBox on a page, and as postbacks occur, I change the items in the list. If there are >= 10 items in the list, I set the Rows property = 10. But if there are less than 10 items, I’d like to set the Rows back to whatever the default value is for Rows.
I see from examining the reflected code that the default value is 4, but I’d rather not hard code it to 4 in my code and instead somehow just reset it to the default.
Is there a way to do this?
You can fetch the default value during the page’s
Initphase. From the documentation:So you can do something like: