Can Calendar Control days be hyperlinks?

  • Thread starter Thread starter Bruce W..1
  • Start date Start date
B

Bruce W..1

When someone clicks on a day in my Calendar control I want to postback
to the same page but with information in a querystring, different for
each day. Rather than posting back twice by using its SelectionChanged
event I want to do it the first time.

I've tried adding links and javascript in the Calendar's DayRender event
like this:
string x = "<a href=\"default.aspx?topic=" +
ViewState["topic"].ToString() +
"date=" + myDate + "</a>";

e.Cell.Attributes.Add("OnClick", x);
But maybe I'm just not doing it right.

It seems in the 1.0 Framework that the Calendar controls will postback
first (to the same page) no matter what. Is there a way I can change
the querystring on the client side?

Thanks for your help.
 
Have you tried setting the Text property of the cell in the DayRender to be
your HTML?
 
Brian said:
do you want just the day text to be a link or the entire cell to be a link?
=========================================================

Either would be fine.
 
just put the link text the normal <a href ='address'>e.day.daynumber</a> in
the text property of the e.cell

(i dont remember the name for the day number i just pulled that off the top
of my head, you will have to look at the member list for it to find it)
 
Back
Top