Binding Events in a Calender From DataBase

Here i am explaining how to bind the events from database in asp Calender.For this we need asp Calender in our Web form.

Create the database as follow
 

Currently i have my database as practice.here i am adding a table as Events.The events table look like as follow. 
 
 

In this table i have 2 columns
  1. one is Events 
  2. one is Date of that events.
Now i am going to bind these events with my calender dates dynamically. For this add a calender control in your asp.net web form.

Click its smart tag for better look and feel of the calender. This will be done as follow.
 
 
 
Increase the height and width of the calender. Go to the .cs page and write the following code in Calender DayRender event.
 
What is DayRender Event ?
 
A-calendar DayRender event occurs when each day is created in the control hierarchy of the calendar control. DayRender event is raised when each date cell in the calendar control is created.
  1. protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)   
  2. {  
  3.   
  4.     Literal l = new Literal(); //Creating a literal  
  5.     l.Visible = true;  
  6.     l.Text = "<br/>"//for breaking the line in cell  
  7.     e.Cell.Controls.Add(l); //adding in all cell  
  8.   
  9.     da = new SqlDataAdapter("select * from Events", con);  
  10.     DataTable dt = new DataTable();  
  11.     da.Fill(dt);  
  12.     foreach(DataRow dr in dt.Rows)   
  13.     {  
  14.         string x = dr[1].ToString();  
  15.   
  16.         if (dr[1].ToString() == e.Day.Date.ToString()) //comparision  
  17.         {  
  18.             Label lb = new Label();  
  19.             lb.Visible = true;  
  20.             lb.Text = dr[0].ToString();  
  21.   
  22.             string a = lb.Text;  
  23.             e.Cell.Controls.Add(lb);  
  24.             e.Cell.BackColor = System.Drawing.Color.OrangeRed; // changing cell color  
  25.             e.Cell.ToolTip = dr[0].ToString(); //adding tooltip  
  26.         }  
  27.     }  
  28. }  
Now it gives the result as follow, binding all  events from db table to the Calender.