views:

129

answers:

3

I want to make a simple ASP.NET page that draws a months from a calendar and highlights given dates. (I'm not looking for a date picker.) What I have is a list of DateTime values and I need to display them a a nice way.

Given that I'm a total beginner with ASP, simpler really is better. (I'd rather not, I'm willing to hack together something with StringBuilder and <table> if it's easier).

p.s. I have no budget, so non-free controls will only be of use to other readers.

A: 

A client side option would be the jQuery calendar plugin

redsquare
That's a bit more complicated than I'm looking for. It might work but 99% of it is unneeded for my case.
BCS
+1  A: 

You can do this with the standard Calendar Control and use the DayRender event to format the individual days. I did something similar to this as my first ASP.Net application (a basic event scheduler) where the special dates were stored in a DB.

<asp:Calendar id = "objCalendar" runat = "server"
      onDayRender = "objCalendar_DayRender"
      Borderstyle = solid
      >

<%
    public void objCalendar_DayRender(object sender, DayRenderEventArgs e) 
    {

     CalendarDay d = ((DayRenderEventArgs)e).Day;

     string strCurrrentDayDisplay = GetDaySchedule(d.Date.ToShortDateString());

     TableCell c = ((DayRenderEventArgs)e).Cell;
     if (d.IsOtherMonth) 
     {
      c.Controls.Clear();
     }
     else 
     {
      try 
      {

       c.Controls.Add(new LiteralControl("<br>" + strCurrrentDayDisplay));
      }
      catch (Exception err) 
      {
       Response.Write (err.ToString());
      }
     }
     d.IsSelectable = false;
    }
%>
David Stratton
That looks like it might be useful...
BCS
It seems to be working. I'm having to beat it into submission (and learning more about ASP.NET in the process) but I don't see any roadblock coming up.
BCS
I would remove the try/catch; the block it surrounds should never fail...
pbz
A: 

It may be too late for this project, but it sounds like BaseCalendar would work.

pbz