Development Tip #1: Wrap your Date Selector inside a User control

When developing web application, you will need to decide which date selector you are going to use , you may choose between the Caledar Extendar , or any other 3'rd party controls (like infragistics ,Telerik ,...).In the future , if you decided to change the date selector for some reason , you will need to go to all places in which you used the date selector and change the code to use the new date selector control !

The required changes could be :

  1. you will need to remove all "<%@ register  " tags that reference the old control
  2. change the pages code behind to use the new control .
  3. also you  may need to change the validations.

 

The Solution :

What I suggest here is that from the Beginning of the development , create a User Control that expose some properties like Selected Date(set , get) , and another property like IsRequired , and inside the user control , you can place any type of date selector control , then you just need to use this user control as a date selector in your web site , and when you want to change the date selector control , you just need to change the user control code .

 

Hope it helps

Anas Ghanem

2 Comments

  • That's a great tip! Thanks!

  • Hello Anas, this will work but not with calendar control only. You need to be aware for all controls you are using.
    Suppose u uses UltraWebGrid from Infragistics and for xyz reason you need to change this~ you will need to do all the dirty work again.
    Anyway this is a reason for many companies which uses their own toolkit.

Comments have been disabled for this content.