Changing styles programmatically

Hi, I am implementing a Menu component. My Menu is located in a Master page and populated by SiteMapProvider.
Here is the HTML code:
CustomCSS="~/html/MenuStyles.css" DataSourceID="SiteMapDataSource1" Layout="Vertical">

Some MenuItems in my menu are not clickable.
To achieve that I have a Menu_PreRender function, where I use Menu2.Items[i].SetClientOnItemSelect("cancelclick()")
On Menu Items, which do not have NavigateURL property set. Here is the code behind:
protected void Menu2_PreRender(object sender, EventArgs e)
{
for (int i = 0; i < Menu2.Items.Count; i++)
{
if (Menu2.Items[i].NavigateUrl == "")
Menu2.Items[i].SetClientOnItemSelect("cancelclick()");
}
}



This works fine, but I need to remove cursor:pointer style on such Menu Items.

How do I do that in my scenatrio? What code do I have to add a code to my Menu2_PreRender function to programmaticcaly chage underlying stylesheet?

Thank you,
Tanya




1 Reply

AD Administrator Syncfusion Team April 1, 2008 11:10 AM UTC

Hi Tanya,

Thanks for your interest in syncfusion products.

You can programmatically change stylesheet in javascript with the following code:



function mouseover(obj)
{
debugger
if(obj.NavigateURL=="")
{
obj.Element.style.cursor="crosshair";
}



Please refer the sample in the link below which illustrates the above:

http://www.syncfusion.com/support/user/uploads/SiteMapDataSourceBinding_7a692de8.zip

Please try running the above sample and let me know if this helps.

Thank you for your patience.

Regards,
Janagan.






Loader.
Up arrow icon