Anas Ghanem

ASP.NET from the middle east

Syndication

Sponsors

News


    Subscribe in a reader
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

Published Saturday, September 20, 2008 1:38 AM by anas
Filed under:

Comments

# re: Development Tip #1: Wrap your Date Selector inside a User control@ Saturday, September 20, 2008 2:19 PM

That's a great tip! Thanks!

by Ryan van der Kooy

# re: Development Tip #1: Wrap your Date Selector inside a User control@ Sunday, September 21, 2008 6:45 AM

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.

by IsToFix

# re: Development Tip #1: Wrap your Date Selector inside a User control@ Sunday, September 21, 2008 8:10 AM

Yes ,of course we must consider every control in the project , but I talked about the data selector because there is no date selector in the asp.net framework,and its very common to use a 3'rd party date selectors.

>>Anyway this is a reason for many companies which uses their own toolkit.

Even the company have there policies,your application should not be tied to a 3'rd party controls , because if the customer asked to change the control look or request additional functionality which requires you to replace the control,you will need to do a lot of modifications,which will also requires a new testing.

By the way , I'm not a big fan with the 3'rd party controls especially when there is already a control in the framework that can do the job.

by anas

Leave a Comment

(required) 
(required) 
(optional)
(required)