This is a migrated thread and some comments may be shown as answers.

RadCalendar and URL

3 Answers 57 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Peter Zolja
Top achievements
Rank 1
Peter Zolja asked on 19 Sep 2008, 10:27 PM
Hi,

Is it possible to use the url to navigate a calendar? I could allow it to post-back and then redirect to mypage.aspx?date=1/9/08, but can I achieve something similar without the extra post-back?

Another approach would be to put the RadCalendar inside an UpdatePanel and right before the postback change the URL dynamically with Javascript. Has anybody attempted to do this?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 22 Sep 2008, 03:01 PM
Hello Peter,

You can do this using DayRender server-side event:

    protected void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
    {
        e.Cell.Text = String.Format(@"<a href=""MyPage.aspx?Date={0}"">{1}</a>", e.Day.Date.ToString(), e.Day.Date.ToString());
    }


Kind regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Peter Zolja
Top achievements
Rank 1
answered on 22 Sep 2008, 06:31 PM
Sorry, I should have been more specific. I'm trying to change the next / previous month links. I'm already customizing the content of each cell. I'm trying to do this so that search engines could follow the calendar.

Thanks.
0
Yavor
Telerik team
answered on 25 Sep 2008, 10:49 AM
Hello Peter,

One option is to use Js to locate the link(s) and alter the href, as shown in the code snippet below:

.aspx
<telerik:RadCalendar runat="server" Id="Calendar1" > 
<ClientEvents OnLoad="onLoad" /> 
</telerik:RadCalendar> 

.Js
<script type="text/javascript">      
                     
               function onLoad()  
               {  
               var link = $get("Calendar1_NN");                 
               link.href="newUrl";                 
               }  
           
</script> 

I hope this suggestion helps.

Kind regards,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Calendar
Asked by
Peter Zolja
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Peter Zolja
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or