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.

Add an ID on a ButtonSettings inside the ribbon

Thread ID:

Created:

Updated:

Platform:

Replies:

119108 May 11,2015 12:09 PM May 18,2015 11:54 PM ASP.NET Web Forms 7
loading
Tags: Ribbon
Rakotondrabesa
Asked On May 11, 2015 12:09 PM

Hi,
I have to add an ID, as how asp button works like: <asp:Button ID="aspButtonID"/> on all button inside my ribbon to check what button is clicked to do an javascript action. Like <ButtonSettings ID="ribbonButtonID"/>
I use the ribbon and the control on the assemblies

<%@ Register Assembly="Syncfusion.EJ.Web, Version=12.4450.0.24, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" Namespace="Syncfusion.JavaScript.Web" TagPrefix="ej" %>
<%@ Register Assembly="Syncfusion.EJ, Version=12.4450.0.24, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" Namespace="Syncfusion.JavaScript.Models" TagPrefix="ej" %>

Can you help me how to have an unique identifier for all button inside the ribbon?
Thanks a lot

Sarath Kumar P [Syncfusion]
Replied On May 12, 2015 08:36 AM

Hi Rakotondrabesa,

Thanks for using Syncfusion products.

We suggest you to provide unique ID for all buttons in the ribbon control use “ContentGroup” tag. Please refer the below Code snippets,

<ej:ContentGroup Id="cut" ToolTip="Cut" Text="Cut">

<ButtonSettings ContentType="TextAndImage" Type="Button" PrefixIcon="e-ribbon e-ribboncut" Click="executeAction" />

</ej:ContentGroup>

<ej:ContentGroup Id="copy" ToolTip="Copy" Text="Copy">

<ButtonSettings ContentType="TextAndImage" Type="Button" PrefixIcon="e-ribbon e-ribboncopy" Click="executeAction" />

</ej:ContentGroup>

<ej:ContentGroup Id="clear" ToolTip="Clear All " Text="Clear">

<ButtonSettings ContentType="TextAndImage" Type="Button" PrefixIcon="e-ribbon clearAll" Click="executeAction" />

</ej:ContentGroup>

To check which button is clicked during an javascript action use text of the button from the event’s arguments.

function executeAction(args) { // In the attached sample we have used common name for all button click events

var val=args.model.text; // Text of the button from the args.

}

Please find the below sample for your reference.

Sample: http://www.syncfusion.com/downloads/support/forum/119108/RibbonButton's_ID-384901057.zip

Please let us know if you need any further assistance.

Regards,

Sarath Kumar P.



Rakotondrabesa
Replied On May 12, 2015 09:39 AM

Hi,
I cannot use args.model.text because our web site is translated into several languages. So when I click on the button ButtonSettings with the attribute Click="executeAction" ,how can I work with the client event function executeAction(args) to know which is clicked?

Sarath Kumar P [Syncfusion]
Replied On May 13, 2015 08:54 AM

Hi Rakotondrabesa,

Thanks for your update.

We suggest you to use individual click event for each button and with this if your requirement is not resolved, please get back to us and we will analyze and update you the response accordingly.

Please let us know if you need any further assistance.

Regards,

Sarath Kumar P.


Rakotondrabesa
Replied On May 13, 2015 10:48 AM

Hi,
I know that it will be work if I use an individual click event for each button ,but I just think that it's a pity if I have to work with many events. Because I would create an Javascript dictionnary to associate the button ID clicked and the action to perform with the button. So I would work just with one event.
Thanks for your help ;) 

Sarath Kumar P [Syncfusion]
Replied On May 14, 2015 06:07 AM

Hi Rakotondrabesa,

Thanks for your update.

We suggest you to use “this._id” to achieve your requirement.Please refer the below Code snippets,

function executeAction(args) {

var val=this._id; //Use this._id to get clicked button’s id.

alert(val + " is clicked");

}

The ID format for ribbon button is Ribbon ID+”_”+Button ID. In the attached sample id of ribbon button “new” will be “defaultRibbon_new”.

Please find the below sample for your reference.

Sample: http://www.syncfusion.com/downloads/support/forum/119108/RibbonButton_id-1860333619.zip

Please let us know if you need any further assistance.

Regards,

Sarath Kumar P.


Rakotondrabesa
Replied On May 18, 2015 03:34 AM

Hi,
Thanks for this help,
I can get  ID with this._id;
regards

Sarath Kumar P [Syncfusion]
Replied On May 18, 2015 11:54 PM

Hi Rakotondrabesa,

Thanks for your update.

Please let us know if you need any assistance.

Regards,

Sarath Kumar P.


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.

;