I need to add UI objects to a page based on the string results of a query. “textbox,textbox,checkbox,textbox”, for example, would display 3 textbox items and a checkbox item on the screen. I also need to read the values that each holds when the user clicks a button.
I’m having a difficult time determining how to hold different types of objects within a collection so I can read all of the values back in the correct order, regardless of the type. I will need some sort of polymorphism for adding and reading the values. Any ideas to push me in the right direction?
Hope this helps. Also if you want to specify names for your checkboxes and textboxes you may also want to store those in your data store so you can at least assign a unique ID that can later be used when you want to read values back in from the UI To do so you would use the FindControl() method and pass in the unique ID name. It would look something like this.
I used a similar method to populate and retrieve values from a detailsView that doens’t use the generic data sources to populate and retrieve values using my business logic layer.