Solved

ASP.NET Calendar IsSelectable false

Posted on 2006-11-02
4
256 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Do we need servers??? 5 196
Blog posts not showing up on Blog page 7 58
best platform for custom social media website and mobile app 2 93
push logos in footer up higher 5 20
Read about why website design really matters in today's demanding market.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

776 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