Calendar and naming <A> i cells

Discussion in 'ASP .Net Building Controls' started by Karsten Lundsgaard, Jul 9, 2003.

  1. I have to name all the Dates in a Calendar-Control, so I
    can select the <A>-tags from javascript.

    The standart output is :
    <TD style="WIDTH: 14%" align="middle"><A style="COLOR:
    black" href="javascript:__doPostBack('DatePicker1

    I need to add : name="DatePicker1_14"

    <TD style="WIDTH: 14%" align="middle"><A
    name="DatePicker1_14" style="COLOR: black"

    I'm using OnDayRender(), and can set the properties in
    the <TD>-tag. How do I set the properties in the <A>-Tag


    Karsten Lundsgaard
    Karsten Lundsgaard, Jul 9, 2003
    1. Advertisements

  2. Hi Karsten,

    I just did a quick check on this and it seems like you're out of luck. The
    private method GetCalendarButtonText is the one in charge of enclosing the
    LiteralControl representing the day number with an <a> element, this method
    is called *after* the DayRender event fires so you don't get a chance to
    modify the <a> element. This situation puts any nice solutions out of the
    picture. What you could do (we're entering the land of nasty solutions
    now...) is to subclass Calendar and override its Render method to call the
    base implementation and then do a search on every <a> element and add the
    required attribute.

    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
    and not by private mail.
    Victor Garcia Aprea [MVP], Jul 12, 2003
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.