views:

28

answers:

1

I have a with dynamic values from an Enum like: String, Int, Double, Bool, DateTime.

How do I create a new Control depending on what is the SelectedValue dynamically into the page? I want a CheckBox for Bool, TextBox for String, Calendar for DateTime etc.

+1  A: 

One way to do this is to create the controls all together and show / hide the ones required depending on SelectedValue, dynamically.

something like

if(someControl.SelectedValue == 1)
{
  Textbox1.Visible = False;
  Textbox2.Visible = True;
}
else  
{
  Textbox1.Visible = True;
  Textbox2.Visible = False;
}
Asad Butt
Oh, yea that one was to obvious to spot i guess! thanks!
Niike2