Solved

Working with calendar selections

Posted on 2006-10-25
2
173 Views
Last Modified: 2010-04-16
I am looking for some help with the calendar control in .NET 2.0, I am writing in c# and using a for each to loop over a DataSet to retrieve a list of dates in a database. I am trying to show the selected dates in the calendar. But I am not having a lot of luck. I found an example online, but it doesn't seem to be what I am looking for.

I wouild appreciate some pointers or references on how this is done. Thanks in advance
CJSantora

This is a portion of the code I am currently using:


    protected void CalDayRender(object sender, DayRenderEventArgs e)
    {
        CalendarDay d = ((DayRenderEventArgs)e).Day;
        TableCell c = ((DayRenderEventArgs)e).Cell;

        if (d.IsOtherMonth)
        {
            c.Controls.Clear();
        }
        else
        {
            try
            {
                   // Need to select the date -
            }
            catch (Exception exc)
            {
                Response.Write(exc.ToString());
            }
        }      
    }
0
Comment
Question by:CJSantora
2 Comments
 
LVL 6

Accepted Solution

by:
e1v earned 500 total points
ID: 17802438
Are you trying to select several dates in the calendar? Then you can use the SelectedDates property of the calendar (at least in asp 2 you can) like:

foreach (DateTime d in yourDateList) Calendar1.SelectedDates.Add(d);
0
 

Author Comment

by:CJSantora
ID: 17818079
Sorry for the slow response, I just have to many projetcts going right now. Your answer was exactly what I needed and I appreciate your help.

CJSantora
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now