Community & Support
Home / Community & Support / Knowledge Base / RadControls for ASP.NET and ASP.NET AJAX / Chart / Disabling click for items in chart image map

Disabling click for items in chart image map

Article Info

Rating: 5

Article information

Article relates to

RadChart v2.x "classic" 
RadChart for ASP.NET AJAX
(Telerik.Web.UI 2008.1.x)

Created by

 Ves, Telerik

Last modified

 April 12 2008

Last modified by

 Ves, Telerik


HOW TO
Disable click for items in chart image maps.

DESCRIPTION
Wiring Radchart’s OnClick event generates image map with all the items clickable. However, sometimes you may want not all of the chart series items to behave as image buttons.
 
SOLUTION
This example presents how to apply appropriate settings to the image map’s area so that clicks are disabled for some of the chart series items. The image map onclick attribute is hooked thus to prevent postback when certain items are clicked by chance. The mouse cursor is also customized not to change to ‘hand’ when you hover over a "non-postback" item.

The forthcoming code snippets illustrates how to support the schema depicted above:




VB:

' Define an item to apply the settings to 
Dim i As Integer = 1 
' Manage cursor: on mouse over - keep the default cursor, on mouse out - clear this setting to regain normal behavior for the rest of the map 
RadChart1.Series(0).Items(i).ActiveRegion.Attributes = "onmouseover=""this.parentNode.parentNode.style.cursor = 'default';"" onmouseout=""this.parentNode.parentNode.style.cursor = '';"" onclick=""return false;""" 
         

C#:
// Define an item to apply the settings to 
int i = 1; 
// Manage cursor: on mouse over - keep the default cursor, on mouse out - clear this setting to regain normal behavior for the rest of the map 
RadChart1.Series[0].Items[i].ActiveRegion.Attributes = "onmouseover=\"this.parentNode.parentNode.style.cursor = 'default';\" onmouseout=\"this.parentNode.parentNode.style.cursor = '';\" onclick=\"return false;\""
         




VB:
       ' Define an item to apply the settings to    
        Dim i As Integer = 1    
        ' Manage cursor: on mouse over - keep the default cursor, on mouse out - clear this setting to regain normal behavior for the rest of the map    
        RadChart1.ChartSeriesCollection(0).Items(i).ItemMap.Attributes = "onmouseover=""this.parentNode.parentNode.style.cursor = 'default';"" onmouseout=""this.parentNode.parentNode.style.cursor = '';"" onclick=""return false;"""    
        RadChart1.ChartSeriesCollection(0).Items(i).ItemMap.HRef = ""    
 

C#:
       //Define an item to apply the settings to    
        int i = 1;    
        //Manage cursor: on mouse over - keep the default cursor, on mouse out - clear this setting to regain normal behavior for the rest of the map    
        RadChart1.ChartSeriesCollection[0].Items[i].ItemMap.Attributes = "onmouseover=\"this.parentNode.parentNode.style.cursor = 'default';\" onmouseout=\"this.parentNode.parentNode.style.cursor = '';\" onclick=\"return false;\"";  
        RadChart1.ChartSeriesCollection[0].Items[i].ItemMap.HRef = "";    
 

You can review the project attached at the bottom of this article for additional reference.

Comments

If you'd like to comment on this KB article, please, send us a Support Ticket.
Thank you!

Please Sign In to rate this article.