How to disable the unneccessary insertions to the markup?
Hello Telerik team!
I am specifically talking about the navigation control. Prior to Sitefinity, we have successfully deployed in our site a very basic navigation menu that basically lists down all items under a category on one portion of the page, just like this:
Item1
Item2
Item3
So of course, the markup of that would be as simple as links wrapped in ul li's then wrapped further with a div right? However, when I tried to apply Sitefinity, using the Navigation control, it inserted so many unnecessary tags to the markup like excessive divs and the like. Kindly see screenshot. Furthermore, these extra tags also gave way for the overriding of our CSS styles and insertion of unneeded scripts. I tried to set certain attributes to false like "EnableTheming" but to no avail. How do I go with this?
Hi jkregala,
You cannot change the way that RadMenu generates its items and the html of them. You have to override the RadMenu control and create a custom scripts for it.
When you use ItemTemplate the control generates <div>tags - <li> <div class="rmText"> </>
All the best,
Ivan Dimitrov
the Telerik team
Thanks, what could be the possible approaches for this? "You have to override the RadMenu control and create a custom scripts for it."
Hello jkregala,
You can disable the embedded java script resources of the control. Then you can download a trial of Telerik RadControls for ASP.NET AJAX from where you can download RadMenuScripts.js and you should modify the _render function
_render:
function
(html)
var
renderSlide =
this
.get_parent().get_items().get_count() == 1;
html[html.length] =
"<li class='"
+
this
._determineCssClass() +
"'>"
;
this
._renderLink(html);
if
(
this
.get_imageUrl())
this
._renderImage(html);
html[html.length] =
"<span class='rmText'>"
;
html[html.length] =
this
.get_text();
html[html.length] =
"</span></a>"
;
this
._renderChildItems(html);
html[html.length] =
"</li>"
;
,