Click here to Skip to main content
15,891,372 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.....
i have a Calendar Control and i want to customize such a way to show the saved event in there cell...with event title and appropriate tooltip ..

i am using this code..
C#
 CalendarMonth_DayRender(object sender, DayRenderEventArgs e)
     {
        ds = objplanner.getEvent(pid, e.Day.Date);
        if (ds.Tables[0].Rows.Count > 0)
          {
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
           if (ds.Tables[0].Rows[i]["Category"].ToString() == "Personal")
               {
                   Label newLine = new Label();
                   newLine.Text = "<br/>";
                   e.Cell.Controls.Add(newLine);
                   LinkButton hlink = new LinkButton();       
                  hlink.Text = "Personal";      
                  hlink.ToolTip = ds.Tables[0].Rows[i]["Title"].ToString();
                  hlink.Attributes.Add("Align", "Center");
                  hlink.Style.Add("Font-Size", "8px");
     hlink.Style.Add("padding-left", "30px");
     hlink.Style.Add("padding-top", "50px");
     hlink.ForeColor = System.Drawing.ColorTranslator.FromHtml("#B39BE4");
     hlink.Attributes.Add("onClick", "hlink_onClick");
      e.Cell.Controls.Add(hlink);
   }


      if (ds.Tables[0].Rows[i]["Category"].ToString() == "Reminder")
                        {
                          //same as above
                        }

  }
//this event is not working ???
        void hlink_onClick(object sender, EventArgs e)
        {
            Response.Redirect("~/WebForm1.aspx");
        }


Problem 1...
although hlink is a LinkButton but i am not able to Click on it...??
i have also add onClick event but never execute..i dont know why ??

Problem 2..
the Calendar Cell Which contains any event Personal/Reminder or both
on that cell i am unable to click on date showed in cell ?????

Problem 3..
i have also add a image button in my calendarcontrol cell...
using e.Cell.Controls.Add(imgbtn)....in all cells it works fine but which cell contains any event ..i can not click on this button...
(problem same like 2 but)

Problem 4..
there can be more than one event for ant particular date falling in same category of Example
Personal...PersonalEvent1 8:00am-12:00am
PersonalEvent2 2:00pm-5:00pm...etc

in this condition i want to show only one event..but i want to show only one indicator in each cell..in this case two times personal will add in my calendar's cell...........

Pls suggest me something to solve these problems...
if any point hasn't cleared then please ..ask
Posted
Updated 16-Feb-11 2:28am
v3
Comments
DaveAuld 16-Feb-11 8:15am    
Edit: removed additional embedded pre block from in the code sample.

1 solution

You can take help from the following article:
Database Driven Event Calendar
 
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