asp.net - Create a control based on value in a DB -


i need create dynamically built page in asp.net app (using vb). page collects parameter information report.

the report information such name, stored procedure , required parameters in db table.

in table have field 'control_type' hoping can use type of control need create collect relevant parameter value selected report. so, if select report01, row form db report01 , parameter data reports row tells me need collect integer value parameter called i_company_id , control create select value form (on dynamically created parameters page) says 'dropdownlist'.

if row db , place filed value variable, can like

dim ddl new varaiblename 

and can populate list normal , then

panel.controls.add(ddl) 

the key bit being able create control type of control create in variable or other dynamically defined way.

i understand following solution delivers want:

private function createvariable(inputname string) object     dim outvariable object = new object      if (inputname = "dropdownlist")         dim targetvariable dropdownlist = new dropdownlist()         targetvariable             'you might change here properties (passed via object array example)         end          outvariable = targetvariable     end if     'add many conditions variables expecting      return outvariable end function 

call doing:

dim ddl object = createvariable("variablename") panel.controls.add(ddl) 

if planning use code controls, can replace object control (will work either way).


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -