• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1305
  • Last Modified:

How can I populate fields from my calendar control day render event

I'm using a Calendar control to view events that are coming from a SQL DB. I can show multiple events per day within the DayRender method by looping through a collection of calendar items. The Calendar control sits within an AJAX Update control. What I want to do is have the ability for users to select a link for a particular event that will populate some textbox controls so that I can then edit/save/delete the calendar item.

The way I'm doing it now is a bit cumbersome and also it refreshes the page which I do not want it to do.
Any ideas on a better more elegant solution would be greatly appreciated.

I've attached the DayRender method

Many thanks
e.Cell.VerticalAlign = VerticalAlign.Top;
        e.Cell.Style.Add("Height", "60px");
        e.Cell.Style.Add("CellPadding", "1px");
        e.Cell.Controls.Add(new LiteralControl("<table ID=\"tblCal\" width='100%'>"));
 
        CalendarItemsFacade cal = new CalendarItemsFacade();
 
        foreach (ICalendarItems calendarItem in cal.GetAllCalendarItems())
        {
            if (calendarItem.EventDate == e.Day.Date)
            {
                e.Day.IsSelectable = false;
                e.Cell.BackColor = ColorTranslator.FromHtml("#64a8ef");
                HyperLink myLink = new HyperLink();
 
                if (calendarItem.Title.Length >= 10)
                {
                    string myString = calendarItem.Title.Substring(0, 7);
                    myLink.Text = myString.PadRight(10, '.');
                }
                else
                {
                    myLink.Text = calendarItem.Title;
                }
 
                e.Cell.Controls.Add(new LiteralControl("<tr><td style=\"width:98px\" valign=\"top\" align=\"left\"><li><a href='default.aspx?calID=" + calendarItem.ID + " '>" + myLink.Text + "</a></li></td></tr>"));
            }
        }
 
        e.Cell.Controls.Add(new LiteralControl("</table>"));

Open in new window

0
Browski
Asked:
Browski
1 Solution
 
RejojohnyCommented:
so what you mean is that you need to click on a date and you must get a ability to enter some fields and they need to be attached to the date you just clicked?

Rejo
0
 
BrowskiAuthor Commented:
Basically I have multiple events per day, in my case the title of the event is a hyperlink that when I click it I want to populate title, description and date text boxes on the form
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now