design pattern for related inputs
Posted
by curiousMo
on Stack Overflow
See other posts from Stack Overflow
or by curiousMo
Published on 2010-04-08T11:18:21Z
Indexed on
2010/04/08
22:13 UTC
Read the original article
Hit count: 233
My question is a design question :
let's say i have a data entry web page with 4 drop down lists, each depending on the previous one, and a bunch of text boxes.
- ddlCountry (DropDownList)
- ddlState (DropDownList)
- ddlCity (DropDownList)
- ddlBoro (DropDownList)
- txtAddress (TxtBox)
- txtZipcode(TxtBox)
and an object that represents a datarow with a value for each:
- countrySeqid
- stateSeqid
- citySeqid
- boroSeqid
- address
zipCode
naturally the country, state, city and boro values will be values of primary keys of some lookup tables.
when the user chooses to edits that record, i would load it from database and load it into the page. the issue that I have is how to streamline loading the DropDownLists.
i have some code that would grab the object,look thru its values and move them to their corresponding input controls in one shot. but in this case i will have to load the ddlCountry with possible values, then assign values, then do the same thing for the rest of the ddls.
I guess i am looking for an elegant solution. i am using asp.net, but i think it is irrelevant to the question. i am looking more into a design pattern.
© Stack Overflow or respective owner