views:

536

answers:

3

I've got a .net calendar up and running and bringing information from a database. By default the day number has a post back action applied to it.

What I'm trying to do is have that action apply to the whole cell so the user doesn't need to click on just the text link.

I'm the dayRenderer action i have the following line to try and replicate the action but the second argument I'm not sure how to set it.

It appears to give it an id e.g. 3315 but I'm not sure how to get the required id manually for this code below. I hope this makes sense! I'm new to .NET so not very savvy with my terminology!

e.Cell.Attributes.Add("OnClick", 
    string.Format("javascript:__doPostBack('{0}','{1}')", 
    Calendar1.ClientID, ***ID_NEEDED_HERE***));
A: 

Hi Ólafur,

The parameter is the number of days since Jan 1 2000 for the first day of your calendar, preceded by a 'V'.

So an ID of 'V0' means Jan 1 2000, an ID of 'V5' means Jan 6 2000, an ID of 'V-5' means Dec 27, 1999.

Cheers,

Ruben

RV
Was me who asked the question but i cant make sense of your answer.
Andi
A: 

putting

e.Cell.Attributes.Add("OnClick",e.SelectUrl);

in your dayRenderer will simulate the number click.

Justin
A: 

This my answer after I tried to figure it out this for about a day. In DayRender Event you have to paste this code or create a Sub() and call it from there

Private AdditionaleText Sub(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs)

dim text as string = "MyText"

e.Cell.Text = "< ref= " & e.SelectUrl & "" style=""color:#663399 font-size: X-small"">""

'Here you also can customize the style of the Text

e.Cell.Text += text & "
" & e.Day.DayNumberText e.Cell.Attributes.Add("OnClick",e.SelectUrl);

End Sub

You could use only the last sentence but is not going to show you the text as a Clickable on, but it works The hole code it looks much better the e.SelectUrl give you the same ref you could retrieve invoking

"javascript:__doPostBack('ctl00$ctl00$MainContent$ContentPlaceHolder1$CalendarSailingDay$Calendar','" & ID & " style=""color:#663399"" >

....that is acctually very confusing. GOOD LUCK!!!