it was a problem when a client in KSA asked that he wants all dates in Islamic Calendar ( Hijri ) dates.
so after nights of searching and trying different methods, i has implemented an easy use usercontrol like the picture below.
I created a usercontrol for this matter to behave like a date picker, toggling between cultures using a dropdown list that changed the page culture. Also I put this user control inside an
UpdatePanel to partially update the calendar without affecting the current page.
How To Use
Below you will find the functions used to set and get the dates in the calendar.
1- drag and drop the user control in the page and register the tag prefix.
2- use the below functions to do all the work.
|1||GetHijriDate()||return a islamic date as string.|
|2||SetHijriDate()||set the calendar date with islamic date.|
|3||SetGregorianDate||set the calendar date with hijri date.|
|4||GetGregorianDate()||return a Gregorian date as string.|
Properties of Hijri Calendar User Control
|1||Future Years||How many years to be shown in the dropdown list of years after this year|
|2||Adjustmentdate||increase or decrease years of the calendar due to any changes in days|
Multiple Instances from the User Control in the Same Page
It was a big challenge for me to allow multiple instances. Because I have to manage the post back and culture changing for all instances. For example if the post back is triggered from the culture dropdown list, year dropdown list, or month dropdown list, the calendar div will stay visible but if triggered by other controls the calendar div status will be changed to hidden.
I tried my best to make this user control free of bugs. Any comments, ideas, and suggestions are most welcome for further improvement in this user control.