Hi,
Is there a way to get the CommandName and CommandArgument of a RadRibbonButton in client side script?
I found a reference in http://www.telerik.com/community/forums/aspnet-ajax/ribbonbar/disabling-button-in-client-side-script.aspx#0
but I'm not sure if this is server side or client side.
Regards,
Peter
Is there a way to get the CommandName and CommandArgument of a RadRibbonButton in client side script?
I found a reference in http://www.telerik.com/community/forums/aspnet-ajax/ribbonbar/disabling-button-in-client-side-script.aspx#0
but I'm not sure if this is server side or client side.
Regards,
Peter
7 Answers, 1 is accepted
0
Hi Peter,
At the moment there isn't a way to get these values on the client, however we will make sure to include this functionality ( get_commandName()/get_commandArgument()/findItemByCommandName() ) in our next official release, which is due in February.
Kind regards,
Bozhidar
the Telerik team
At the moment there isn't a way to get these values on the client, however we will make sure to include this functionality ( get_commandName()/get_commandArgument()/findItemByCommandName() ) in our next official release, which is due in February.
Kind regards,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Michael
Top achievements
Rank 1
answered on 14 Mar 2013, 02:20 PM
So how do you determine which RibbonBar Button was pressed via javascript?
0
Hi Michael,
Plamen
the Telerik team
You can use the OnClientButtonClicking or OnClientButtonClicked client events which point to the button clicked.
Hope this will be helpful.
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Vladimir
Top achievements
Rank 1
answered on 10 Dec 2013, 09:22 PM
Hi,
is there possibe to get and set commandname and commandargument on client side?
I cannot see still it in new release.
Thanks
Vlad
0
Shinu
Top achievements
Rank 2
answered on 11 Dec 2013, 04:01 AM
Hi
Vladimir,
Please have a look into the following code snippet to get and set the CommandName and CommandArgument of RibbonBarButton.
ASPX:
JavaScript:
Thanks,
Shinu.
Please have a look into the following code snippet to get and set the CommandName and CommandArgument of RibbonBarButton.
ASPX:
<
telerik:RadRibbonBar
ID
=
"RadRibbonBar1"
runat
=
"server"
CssClass
=
"demo"
>
<
telerik:RibbonBarTab
Text
=
"Tab2"
Value
=
"2"
runat
=
"server"
ID
=
"RibbonBarTab"
>
<
telerik:RibbonBarGroup
>
<
Items
>
<
telerik:RibbonBarSplitButton
Text
=
"splitbutton"
ID
=
"RibbonBarSplitButton1"
>
<
Buttons
>
<
telerik:RibbonBarButton
ID
=
"RibbonBarButton1"
Text
=
"Button1"
CommandName
=
"open"
CommandArgument
=
"close"
Value
=
"value1"
/>
<
telerik:RibbonBarButton
ID
=
"RibbonBarButton2"
Text
=
"Button2"
Value
=
"value2"
/>
</
Buttons
>
</
telerik:RibbonBarSplitButton
>
</
Items
>
</
telerik:RibbonBarGroup
>
</
telerik:RibbonBarTab
>
</
telerik:RadRibbonBar
>
JavaScript:
<script type=
"text/javascript"
>
function
pageLoad() {
var
ribbonbar = $find(
"<%=RadRibbonBar1.ClientID %>"
);
var
button1 = ribbonbar.findButtonByValue(
"value1"
);
var
button2 = ribbonbar.findButtonByValue(
"value2"
);
button2._commandName =
"check"
;
button2._commandArgument =
"demo"
;
alert(
"Button1 CommandName "
+ button1.get_commandName());
alert(
"Button1 CommandArgument "
+ button1.get_commandArgument());
alert(
"Button2 CommandName "
+ button2.get_commandName());
alert(
"Button2 CommandArgument "
+ button2.get_commandArgument());
}
</script>
Thanks,
Shinu.
0
Vladimir
Top achievements
Rank 1
answered on 11 Dec 2013, 10:01 AM
Hi Shinu,
thanks for reply. Getters works correctly. But I cannot set command argument on client side and receive on server. So it is not possible?
Thank you
Vlad
0
Shinu
Top achievements
Rank 2
answered on 12 Dec 2013, 04:17 AM
Hi Vladimir,
As a work around you can set the CommandName and CommandArgument of RibbonBarButton in the HiddenField and access it in the Server Side. Please have a look into the following code snippet.
JavaScript:
C#:
Thanks,
Shinu.
As a work around you can set the CommandName and CommandArgument of RibbonBarButton in the HiddenField and access it in the Server Side. Please have a look into the following code snippet.
JavaScript:
<script type=
"text/javascript"
>
function
pageLoad() {
var
ribbonbar = $find(
"<%=RadRibbonBar1.ClientID %>"
);
var
button2 = ribbonbar.findButtonByValue(
"value2"
);
button2._commandName =
"check"
;
document.getElementById(
"Hidden1"
).value = button2.get_commandName();
button2._commandArgument =
"demo"
;
document.getElementById(
"Hidden2"
).value = button2.get_commandName();
}
</script>
C#:
string
commandname = Hidden1.Value;
string
commandargu = Hidden2.Value;
Thanks,
Shinu.