Click here to Skip to main content
16,004,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ASP :Calander --set selected dates from databse having styles
Posted
Comments
ZurdoDev 9-Apr-12 10:44am    
Please do not repost. Use the Improve Question on the original post if you need to add something.

1 solution

Hi @Shishir26

try this
here we have dates which are coming from database to datatable dtCalenderDaysFromDB(Dates whcih we want to change for CSS)
C#
protected void calenderWrkDt_DayRender(object sender, DayRenderEventArgs e)
   {
       if (dtCalenderDaysFromDB.Rows.Count > 0)
       {
           if (!e.Day.IsOtherMonth)
           {
               for (int i = 0; i < dtCalenderDaysFromDB.Rows.Count; i++)
               {
                   DateTime dtEventDT = Convert.ToDateTime(dtCalenderDaysFromDB.Rows[i]["EventDate"]);
                   if (dtEventDT.Equals(e.Day.Date))
                   {
                      e.Cell.ForeColor = Color.DarkGreen;
                   }
               }
           }
       }
   }

Hope it will help you
Thanks
 
Share this answer
 
v2

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