Solved

ASP.NET Calendar IsSelectable false

Posted on 2006-11-02
4
245 Views
Last Modified: 2012-06-27
hi, im having a problem on my asp calendar.

It is currently reading in data from a database.

I want it to be able to disallow somone from clicking on a date which has text in it.

here is my code.

      protected void eventscalendar_DayRender(Object Src, DayRenderEventArgs E)
      {
            StringBuilder strEvents = new StringBuilder();
            strEvents.Append("<span style=\"font-size:80%\">");
            
            foreach (DataRow row in ds.Tables["events"].Rows)
            {
                  DateTime eventdate = (DateTime)row["eventdate"];
                  if (eventdate.Equals(E.Day.Date))
                        strEvents.Append("<br />" + row["eventtext"]);            
            }
            strEvents.Append("</span>");
            E.Cell.Controls.Add(new LiteralControl(strEvents.ToString()));
            }

i have tried this

      if (E.Cell.Controls.Count == 1)
      {
      E.Day.IsSelectable=false;
      }

and

E.Day.IsSelectable=false;

but it either disables all the dates or doesnt.

can anyone help me?

thanks
0
Comment
Question by:thomasmutton
4 Comments
 

Author Comment

by:thomasmutton
ID: 17859466
ok i solved it myself

i used

protected void eventscalendar_DayRender(Object Src, DayRenderEventArgs E)
      {
            StringBuilder strEvents = new StringBuilder();
            strEvents.Append("<span style=\"font-size:80%\">");
            
            foreach (DataRow row in ds.Tables["events"].Rows)
            {
                  DateTime eventdate = (DateTime)row["eventdate"];
                  if (eventdate.Equals(E.Day.Date))
                  {
                        strEvents.Append("<br />" + row["eventtext"]);      
                        E.Day.IsSelectable=false;
                  }
                  
                  if (E.Cell.Text == null)
                  {
                        E.Day.IsSelectable=true;
                  }
                                                      
            strEvents.Append("</span>");
            E.Cell.Controls.Add(new LiteralControl(strEvents.ToString()));
            }      
      }
0
 
LVL 16

Expert Comment

by:ellandrd
ID: 17861406
OK open a 0 point question in CS to request for this question to be closed.

ellandrd ;-)
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 18062132
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

932 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

16 Experts available now in Live!

Get 1:1 Help Now