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

RadDatePicker - Day href problem

5 Answers 62 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Amit
Top achievements
Rank 1
Amit asked on 29 Jul 2009, 11:36 AM

I am using RadDatePicker control in my site and my problem is I want to remove href=”#” from “A” tag of Day cell.


i.e : see the following link and open pop up for date picker and mouse over on any day and see in the status bar there is one “#”


Click here to see demo...


Actually  RadDatePicker  generate HTML code for particuler day is...

<a href="#">18</a>

and i want like....

<a href="javascript:void(0);">18</a>



Note : I am using this version of Rad Control : 2009.1.402.35

5 Answers, 1 is accepted

Sort by
0
Amit
Top achievements
Rank 1
answered on 31 Jul 2009, 04:48 AM
Hello Telerik Team....

Please Reply me...

is this possible or not???


Thnx in Advance....
0
Dimo
Telerik team
answered on 03 Aug 2009, 08:52 AM
Hello Amit,

I am not sure why you need to change the href attributes of the day cells, but you can do it like this:


<%@ Page Language="C#" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<script runat="server"
 
</script> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
<meta http-equiv="content-type" content="text/html;charset=utf-8" /> 
<title>RadControls for ASP.NET AJAX</title> 
</head> 
<body> 
<form id="form1" runat="server"
<asp:ScriptManager ID="ScriptManager1" runat="server" /> 
 
<telerik:RadDateTimePicker ID="RadDateTimePicker1" runat="server" /> 
 
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
<script type="text/javascript"
 
Sys.Application.add_load(changeAs); 
 
function changeAs() 
    var as = $find("RadDateTimePicker1").get_calendar().get_element().getElementsByTagName("a"); 
    for (var j = 0; j < as.length; j++) 
    { 
        as[j].href = "javascript:void(0);"
    } 
 
</script> 
</telerik:RadCodeBlock> 
 
</form> 
</body> 
</html> 


Greetings,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Amit
Top achievements
Rank 1
answered on 07 Aug 2009, 09:12 AM
Hello Dimo,

Thank you for your suggestion...
I need to change the "href" attributes for SEO.

from my side i am also apply your suggestion but it remove "#" when you mouse over then in status bar it display "javascript:void(0);"
but it can't replace "#" to "javascript:void(0);" in Source code.


Thank You
-- Amit Patel
0
Dimo
Telerik team
answered on 07 Aug 2009, 11:38 AM
Hello Amit,

Well, in this case, please use a server-side approach - the DayRender event of the Calendar:

protected void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
{
       e.Cell.Text = e.Cell.Text.Replace("href=\"#\"", "href=\"javascript:void(0);\"");
}

By the way, how this change will improve the page's SEO ?


Sincerely yours,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Amit
Top achievements
Rank 1
answered on 20 Aug 2009, 10:59 AM
Hello Dimo

Thank you very much again for your suggestions....

Dimo i have also one problem regarding performance.....

when i save my web page in html format then it create ScriptResource.axd and  ScriptResource.js file that's why my page size is very bigg...

so any solutions to remove those files or increase performance.....


Sincerely yours,
Amit Patel


Tags
Calendar
Asked by
Amit
Top achievements
Rank 1
Answers by
Amit
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or