Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 28th, 2006, 01:26 AM
Authorized User
 
Join Date: May 2006
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.


 
Old July 28th, 2006, 12:12 PM
Authorized User
 
Join Date: May 2006
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.

 
Old July 28th, 2006, 12:14 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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
 
Old July 28th, 2006, 12:27 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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
 
Old July 28th, 2006, 12:43 PM
Authorized User
 
Join Date: May 2006
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;
        }
    }

 
Old July 28th, 2006, 12:51 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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





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





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