Calendar and naming <A> i cells

  • Thread starter Karsten Lundsgaard
  • Start date
K

Karsten Lundsgaard

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
$_ctl2','1310')">3</A></TD>

I need to add : name="DatePicker1_14"

<TD style="WIDTH: 14%" align="middle"><A
name="DatePicker1_14" style="COLOR: black"
href="javascript:__doPostBack('DatePicker1
$_ctl2','1310')">3</A></TD>

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


Regards

Karsten Lundsgaard
 
V

Victor Garcia Aprea [MVP]

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:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
and not by private mail.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top