Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 28th, 2006, 01:26 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calendar Control in a wizard

I have a calendar control in a wizard, and i would like to set the days prior to today's date as unselectable.

    protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
    {

        if (e.Day.Date < DateTime.Today)
        {
            Wizard1.FindControl("Calendar1").e.Day.IsSelectabl e = false;
            e.Cell.BackColor = System.Drawing.Color.Black;
        }
    }

I know that isn't going to work, but I have been trying a bunch of different combinations, any help would be appreciated.
Thanks.


Reply With Quote
  #2 (permalink)  
Old July 28th, 2006, 12:12 PM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is why i won't buy another wrox book. I have spent over $100 on beginning asp.net 2.0 and professional asp.net 2.0 and they only cover the most basic scenarios. If anyone can tell me where the answer to this question can be found in either of those books I would be more than happy to answer this question myself. But for the life of me, I can't find anywhere those books reference how to expose these properties from within another control. I understand the scope of these books is not to teach someone how to program, but a few examples of situations outside the box would go a long way in helping people figure it out.

Reply With Quote
  #3 (permalink)  
Old July 28th, 2006, 12:14 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Isn't it as simple as:

e.Day.IsSelectable = false;

??

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Reply With Quote
  #4 (permalink)  
Old July 28th, 2006, 12:27 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

I think your post just crossed mine.

I understand what you're saying about these books. However, there are so many topics available, it's not difficult to find something that's not discussed. I don't have those books, but I can imagine they do discuss FindControl somewhere?

Although you said you don't want Wrox books anymore, you could take a look at books like ASP.NET 2.0 Instant Results or ASP.NET 2.0 Website Programming: Problem - Design - Solution, also by Wrox.

Instead of discussing many separate topics, these books cover more complicated applications, zooming in on the more advanced features of ASP.NET.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Reply With Quote
  #5 (permalink)  
Old July 28th, 2006, 12:43 PM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry Imar, I was throwing a temper tantrum after working on such a simple thing for the last 12 hours. I think I need to get some more books. But in any case, the problem is that the event is not getting called. Anything I put in that function doesn't happen.

the calendar is just

<asp:Calendar ID=Calendar1" runat="server"></asp:Calendar>

 within step one of the wizard. and the text for the function is

   protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
    {

        if (e.Day.Date < DateTime.Today)
        {
            e.Day.IsSelectable = false;
            e.Cell.BackColor = System.Drawing.Color.Black;
        }
    }

Reply With Quote
  #6 (permalink)  
Old July 28th, 2006, 12:51 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Right. That explains a lot. You need to tell the calendar what method is responsible for handling the event:

<asp:Calendar ID="Calendar1" runat="server"
   OnDayRender="Calendar1_DayRender"></asp:Calendar>

Otherwise, your Calendar1_DayRender method is just a simple method, and not an event handler for the DayRender event....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wizard Control Reference Colonel Angus .NET Framework 2.0 0 April 28th, 2008 08:54 AM
wizard control MunishBhatia ASP.NET 2.0 Basics 0 April 15th, 2008 12:35 AM
wizard control Bill Crawley ASP.NET 2.0 Professional 0 July 12th, 2007 09:55 AM
Navigation Wizard Control everest ASP.NET 2.0 Professional 0 January 17th, 2007 06:22 PM
Wizard Control Problem everest ASP.NET 2.0 Professional 0 December 19th, 2006 12:38 PM



All times are GMT -4. The time now is 04:44 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.