Hi all,
I have reviewed custom command help and I understand how to create a simple custom command -- e.g. something that would display an alert when the custom command is clicked.
I would like to extend this to running non-javascript code. I have some C# which toggles a Microsoft Chart Control's legend and resizes the graph accordingly. I would like to have this be a custom command.
Do I need to use regular AJAX for this? My basic thought process is this:
- Assign a new Command to my Dock named ToggleLegend:
- Create the corresponding JavaScript:
- Over in my C# Class:
I haven't tested this and I suspect it is an incorrect way of achieving my desired goal. Could someone confirm that this is the correct way of achieving this while using RAD Controls, or is there a nicer way?
Regards,
Sean Anderson
I have reviewed custom command help and I understand how to create a simple custom command -- e.g. something that would display an alert when the custom command is clicked.
I would like to extend this to running non-javascript code. I have some C# which toggles a Microsoft Chart Control's legend and resizes the graph accordingly. I would like to have this be a custom command.
Do I need to use regular AJAX for this? My basic thought process is this:
- Assign a new Command to my Dock named ToggleLegend:
<
Commands
>
<
telerik:DockCommand
Text
=
"Toggle Legend"
OnClientCommand
=
"ToggleLegend"
/>
</
Commands
>
- Create the corresponding JavaScript:
<
script
type
=
"text/javascript"
>
function ToggleLegend(dock, args) {
MyAjaxedClassHere.ToggleLegend(ToggleLegend_CallBack);
}
</
script
>
- Over in my C# Class:
[Ajax.AjaxMethod()]
private
void
ToggleLegend()
{
//Code Here
}
I haven't tested this and I suspect it is an incorrect way of achieving my desired goal. Could someone confirm that this is the correct way of achieving this while using RAD Controls, or is there a nicer way?
Regards,
Sean Anderson