Clearing the days of anydata

Discussion in 'ASP .Net Web Controls' started by Ron Harter, Jul 3, 2009.

  1. Ron Harter

    Ron Harter Guest

    I am new to ASP .Net and still learning so please bear with me. I have a
    calendar control where I need the days that are not part of the current
    month to be empty. I can't find anything in the documentation on how to do
    this so I ended up setting the foreground and background color to be the
    same for the OtherMonthDayStyle. Data is still being rendered in the cell
    for that day but it is invisible.

    This seems kludgey to me and I was wondering of anyone has a cleaner way to
    not show anything.



    -----
    Ron Harter | Tongue, Tied and Twisted
    | Just An Earthbound Misfit ... I
    | Pink Floyd
     
    Ron Harter, Jul 3, 2009
    #1
    1. Advertising

  2. Ron Harter

    Stan Guest

    On 3 July, 00:39, "Ron Harter" <> wrote:
    > I am new to ASP .Net and still learning so please bear with me. I have a
    > calendar control where I need the days that are not part of the current
    > month to be empty. I can't find anything in the documentation on how to do
    > this so I ended up setting the foreground and background color to be the
    > same for the OtherMonthDayStyle. Data is still being rendered in the cell
    > for that day but it is invisible.
    >
    > This seems kludgey to me and I was wondering of anyone has a cleaner way to
    > not show anything.
    >
    > -----
    > Ron Harter                     | Tongue, Tied and Twisted
    > | Just An Earthbound Misfit ... I
    >                                         |               Pink Floyd


    Try this in the RenderDay event

    if (e.Day.IsOtherMonth)
    {
    e.Cell.Controls.Clear(); // remove the date selector link
    button
    e.Cell.Text = "&nbsp;"; // insert a placeholder for the
    empty cell
    }

    Note that since the calendar is rendered as a table, the empty cell
    must contain something to preserve the structure. Hence the &nbsp;
    character (non-break space).
     
    Stan, Jul 5, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Federico Bari

    XML, DBI::AnyData and mySQL

    Federico Bari, Jan 28, 2004, in forum: XML
    Replies:
    0
    Views:
    387
    Federico Bari
    Jan 28, 2004
  2. David Stockwell
    Replies:
    2
    Views:
    724
    Anna Martelli Ravenscroft
    Sep 20, 2004
  3. Gerrit
    Replies:
    0
    Views:
    406
    Gerrit
    Sep 20, 2004
  4. Federico Bari

    XML, DBI::AnyData and mySQL

    Federico Bari, Jan 27, 2004, in forum: Perl Misc
    Replies:
    0
    Views:
    140
    Federico Bari
    Jan 27, 2004
  5. Replies:
    5
    Views:
    198
Loading...

Share This Page