newbie: user control question

  • Thread starter Thread starter Markus
  • Start date Start date
M

Markus

Hi all!

Currently I have some asp.net pages that nearly implement the same
functionality - so I would like to combine them into one user control. My
question is: is it possible to pass parameters to the user control's
constructor? I would like to specify a parameter that tells the control what
to do internally (e.g. if param=1 then display textbox else display
dropdownbox). The parameter should be stored in ViewState. I could implement
public properties on the control, but I want the parameters to be set only
once.


Thanks

Markus
 
User Control Constructors are not instantiated directly. Instead, you use
LoadControl() to load the UserControl. Therefore, I think going with
properties is your best bet.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Back
Top