Search
English
Customizing the toolbox in Ria OLAP controls

This article discusses customizing Ria OLAP control's toolbox. Read the article on the HTML OLAP Grid toolbox customization here.

You can add your own buttons, specifying their appearance, tooltip, the way of handling the pressing event, including callback, postback and client script.


Overriding the on-click actions of the standard toolbox buttons

For overriding the standard on-click actions you should handle the ToolboxItemAction event.
The handler of this event is called right before performing the standard action. The parameter of the ToolboxItemActionArgs type, passed to the event, contains all the information for processing the user's action.
In the event handler, you can define what button is pressed by examining the e.Item property, and prevent fulfilling of the standard action by setting the e.Handled flag to True.

For example, let's override the standard on-click action of the Save button. The default on-click action is saving the current state of the Grid and sending it to the user in a XML file. We'll make it save the current Grid state to the database:

protected void TOLAPGrid1_ToolboxItemAction(object sender, GridToolboxItemActionArgs e)
{
    if (e.Item is RSaveLayoutToolboxButton)
    {
        string xmlstring = TOLAPGrid1.Serializer.XMLString; // save the string to the database 
        e.Handled = true;
    }
}

Adding new buttons to the Toolbox

To add a button to the Toolbox you just need to put an appropriate object to the Buttons.CustomButtons collection. You can do it either programmatically (in the Page_Init event handler, not later!) or in DesignTime.
When you create a user button instance programmatically, mind that the ButtonID property value should be unique for each button and remain unchanged from session to session. In general, each of the user’s buttons, added to the Toolbox, should have a unique value of the ButtonID property, by which it can be identified in ToolboxItemAction event handler.
In addition to the ButtonID and such self-explanatory properties as Image and Tooltip, each button has a very important HandlingType property that defines the way of processing the action of pressing the button. There are three possible ways to process the pressing of a Toolbox button:

  • Postback-processing on the server
  • Callback-processing on the server
  • Firing a client script
protected void TOLAPGrid1_Init(object sender, EventArgs e)
{
    //Create the custom button that calls the client script
    RCustomToolboxButton item = new RCustomToolboxButton();
    item.ButtonID = "13460583-0ae4-4ec3-8d2f-2cbf914928a0";
    item.ButtonType = TToolButtonType.Button;
    item.ClientScript = "alert('Hello!')";
    item.Tooltip = "Custom button (calls the client script)";
    item.Visible = true;
    item.Image = "~/Images/scriptBtn.png";
    item.HandlingType = TClientActionHandlingType.ClientOnly;
    TOLAPGrid1.Buttons.fToolItems.Add(item.ButtonID, item);

    //Create the custom button that sends the callback on the server
    item = new RCustomToolboxButton();
    item.ButtonID = "50257885-2cca-4290-86e0-618a57bf62a0";
    item.ButtonType = TToolButtonType.Button;
    item.Tooltip = "Custom button (PostBack)";
    item.Visible = true;
    item.Image = "~/Images/postbackBtn.png";
    item.HandlingType = TClientActionHandlingType.Postback;
    TOLAPGrid1.Buttons.fToolItems.Add(item.ButtonID, item);

    //Create the custom button that sends yhe postback on the server
    item = new RCustomToolboxButton();
    item.ButtonID = "c9fb43c6-6c59-40d5-8255-eaee767c0b21";
    item.ButtonType = TToolButtonType.Button;
    item.Tooltip = "Custom button (CallBack)";
    item.Visible = true;
    item.Image = "~/Images/callbackBtn.png";
    item.HandlingType = TClientActionHandlingType.Callback;
    TOLAPGrid1.Buttons.fToolItems.Add(item.ButtonID, item);
}

For processing the pressing of the button, you need to write a ToolboxItemAction event handler:

protected void TOLAPGrid1_ToolboxItemAction(object sender, GridToolboxItemActionArgs e)
{
if ((e.Item is RCustomToolboxButton) && (e.Item.ButtonID == "50257885-2cca-4290-86e0-618a57bf62a0"))    
        {        
            // do some action    
        }
}
Related links

Download Radar-Soft products


Buy Radar-Soft products


Visit our support site


Hot news
Click to subscribe

 July 22, 2010

RadarCube for WPF beta is here

The new RadarCube for WPF version has started.

Details...

 

Latest versions
Click to subscribe

 July 14, 2010

RadarCube ASP.NET 2.44.3

Changes...Download...

 

 June 25, 2010

RadarCube WinForms Desktop 2.31.0

Changes...Download...

 

 June 25, 2010

RadarCube WinForms MSAS 2.31.0

Changes...Download...

 

 May 20, 2010

RadarCube VCL 1.18.0

Changes...Download...

 

 April 22, 2010

HierCube VCL 4.56.0

Changes...Download...

 

 July 15, 2009

Essential Pack Pro for ASP.NET 1.11.0

Changes...Download...

 

 July 15, 2009

Essential Pack for ASP.NET 1.11.0

Changes...Download...

 

 November 5, 2008

WinForms Chart 1.00.1

Changes...Download...

 

Related articles
Click to subscribe

 May 5, 2010

New Silverlight add-on for RadarCube ASP.NET

Details...

 

 March 30, 2010

Designing the Cube with the Cube Creation Wizard

Details...

 

 December 16, 2009

Creating custom Time Intelligence

Details...

 

 November 26, 2009

Creating the correct Cube structure

Details...

 

 September 30, 2009

RadarCube Request tracker

Details...

 

 August 24, 2009

Customizing the toolbox in Ria OLAP controls

Details...
More articles...
Support | Download | Purchase | Partners | Upgrade and Discount Policy | Contacts © 2005-2010 Radar-Soft, L.L.C. All rights reserved.