This is a bit of a complicated one and I'm not sure how to approach it.
I want to implement a system for dynamically generating controls in an ASP.NET page. I have the basic logic in my head about creating the controls, the main issue is in storing the data that's entered in the controls.
If I explain a bit more. Let's say, for example, a page was generated that contained a Date type control, a text type control and an integer valued dropdown type control. When a user browsers to the page, they might have the following controls:-
If a user enters data into each box, I then want to store these values in a db table.Code:Date box <asp:textbox id="1" runat="server" style="text-align:center" maxlength="10" /> <calendar control here /> Text box <asp:textbox id="2" runat="server" /> Select box with integers as values <asp:dropdownlist id="3" runat="server />
What I already have is a table that will contain the objects to be displayed and I can then relate the data table to these objects.
What I'm not sure about is how to setup the data holding table? I'm thinking something like:-
dataref INT :- PK field
objref INT :- ref from object table
data ??? :- field holding the data.
I'm not sure if I should just have one field to hold the data and make it a VARCHAR field and then convert the data in code into whatever data type it should be?
Or should I create a DATE field, a VARCHAR field and an INT field and then use whichever one I need depending on the obj type data being saved?
I hope that makes sense.
Any thoughts?



LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks