Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP.NET Calendar IsSelectable false

Posted on 2006-11-02
4
Medium Priority
?
296 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

618 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