ComponentOne ToolBar for ASP.NET AJAX: Working with the Client-Side ToolBar > Client-Side Events

Client-Side Events

C1ToolBar includes several client-side events that allow you to manipulate the toolbar items in the C1ToolBar control when an action such as clicking the item, hovering over or out of the toolbar item occurs.

You can access these client-side events from the Properties window. To create a new client-side event using the Properties window, select the drop-down arrow next to a client-side event and select Add new client side handler.

Once you've added the client-side handler, Visual Studio will add a script to the Source view. That script will resemble the following:

<script type="text/javascript" id="ComponentOneClientScript">

function C1ToolBar1_OnClientItemClick(sender, eventargs){

  //

  // Put your code here.

  //

};

</script>

Each of the client-side events requires two parameters: the ID that identifies the sender C1ToolBar, in this example, C1ToolBar1, and an eventArgs that contains the data of the event.

You can use the sever-side properties, listed in the Client Side Event table, to specify the name of the JavaScript function that will respond to a particular client-side event. For example, to assign a JavaScript function called "ItemClick" to respond to the clicked item, you would set the OnClientItemClick property to "ItemClick".

The following table lists the events that you can use in your client scripts. These properties are defined on the server side, but the actual events or the name you declare for each JavaScript function are defined on the client side.

Client Side Event table

Event Server-Side Property Name

Event Name

Description

OnClientDropDownClose

DropDownClose

Fires on client side when toolbar item’s nested list is closed.

OnClientDropDownOpen

DropDownOpen

Fires on client side when nested list is opened.

OnClientItemBlur

ItemBlur

Fires on client side when toolbar item looses focus.

OnClientItemCheck

ItemCheck

Fires on client side toolbar item is checked.

OnClientItemClick

ItemClick

Fires on client side when toolbar item is clicked.

OnClientItemFocus

ItemFocus

Fires on client side when toolbar item is focused.

OnClientItemMouseDown

ItemMouseDown

Fires on client side when mouse is down on toolbar item.

OnClientItemMouseOut

ItemMouseOut

Fires on client side when mouse becomes out of a toolbar item.

OnClientItemMouseOver

ItemMouseOver

Fires on client side when mouse is over toolbar item.

OnClientItemMouseUp

ItemMouseUp

Fires on client side when mouse is up on the toolbar item.

OnClientItemSelect

ItemSelect

Fires on client side when the toolbar item is selected.

 

These events are useful for providing client-side interactivity. With these events you can provide more control over C1ToolBar by controlling how the users interact with C1ToolBar. For example you can use the ItemMouseOver event to prevent nested toolbar items from expanding when the user mouses over toolbar items or the ItemClick event to add, remove, or disable toolbar items when the user clicks on an existing toolbar item.


Send comments about this topic to ComponentOne.
Copyright © 1987-2010 ComponentOne LLC. All rights reserved.