views:

56

answers:

2

Hi guys,

I wonder when do you consider to create a user control in .NET? Do you have some basic criteria to exclude your code from the page and introduce a new user control?

Usually I tend to follow those to decide whether I need a user control or not:

  • When the page seems to be more readable with a separate user control
  • When some part of the form looks like to be used from different pages again and again

How about you?

thanks, kalem keki

A: 

I think the 2 reasons you provide are the main reasons anyone would create a user control. I really can't think of any other valid reasons...

Quagmire
+3  A: 

I suppose it follows the following:

  • Do I need to separate this component out from the common code?
  • Do I use this item often, meaning I need to keep recreating it?
  • Do I need to be able to template this to suit different styles?
Kyle Rozendo