Click here to Skip to main content
15,919,931 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

i am using jquery ui datepicker in
In calendar i need to highlight(by changing color etc.) holidays which was fetched from sql server.

will any please help me what was the procedure to bind holidays list from database to jquery ui calendar???

thanks in advance....

// list of dates to highlight
var dates = [
    [2011, 8, 1],
    [2011, 8, 9],
    [2011, 8, 25]

    beforeShowDay: function (date){
        var year = date.getFullYear(), month = date.getMonth(), day = date.getDate();

        // see if the current date should be highlighted
        for (var i=0; i < dates.length; ++i)
            if (year == dates[i][0] && month == dates[i][1] - 1 &&  day == dates[i][2])
            return [false, 'ui-state-highlight'];

        return [false];

Original answer :[^]
Share this answer
Charan_Kumar 26-Jun-13 6:05am    
thanks ahmed for your reply..
but i need to bind from sql server database..
will you please help me???????
Ahmed Bensaid 26-Jun-13 6:26am    
So, you can retrieve dates from your db. You put them in c# variables. Then, you can access them from your javascript code like this <%= your_codebehind_variable %>.
Hope it helps.
Charan_Kumar 26-Jun-13 7:44am    
will u please provide me some helpful links????
Ahmed Bensaid 26-Jun-13 8:20am
i got the solution using webmethod
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900