Solved

ASP.NET Calendar IsSelectable false

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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
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 viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

808 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