We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Changing styles programmatically

Thread ID:

Created:

Updated:

Platform:

Replies:

72500 Mar 24,2008 10:41 AM Apr 1,2008 07:10 AM ASP.NET Web Forms (Classic) 1
loading
Tags: Tools
Tanya
Asked On March 24, 2008 10:41 AM

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




Administrator [Syncfusion]
Replied On April 1, 2008 07:10 AM

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.






CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;