I have a RadNumericTextbox and I want to assign two javascript events to fire for the OnValueChanged.
So lets say I have JavaScript methods called MethodA(); and MethodB(); that I want to call. What I would like to do would be something like this:
So the first question is, can this be done? If so, what is the format? I can't seem to make it work.
Secondly, one of the methods I'm adding sets a 'FormHasChanged' bool to True... but based on another forum post I read it would seem the 'OnValueChanged' fires once when the page loads and the control populates the value initially... is there a way to modify this behavior? The other post suggested tracking the before and after values... this is far from ideal as I would like to be able to generically add a call to set the bool when the value changes.
The big picture is this:
From a random page's code behind I want to be able to call a function I created like so:
So my two issues are 1) I can't seem to stack method calls and 2) If the 'OnValueChanged' fires at page load, then the page will ALWAYS think the form has changed... and if I have to track before/after values, then that would require a MASSIVE amount of additional coding...
Thoughts?
So lets say I have JavaScript methods called MethodA(); and MethodB(); that I want to call. What I would like to do would be something like this:
<telerik:RadNumericTextBox ID="rntMyTextBox" Type="Number" runat="server"I am able to stack methods on other HTML properties, such as when I add an onChange="alert('A'); alert('B');" property and change the value via the page, then I get the expected message boxes, the first saying A, the second saying B.
MaxValue="997" EnabledStyle-HorizontalAlign="Right" Font-Size="Small" MaxLength="3"
MinValue="0" Width="153px" FocusedStyle-PaddingRight="1px" ShowSpinButtons="true"
ClientEvents-OnValueChanged="MethodA(); MethodB();">
So the first question is, can this be done? If so, what is the format? I can't seem to make it work.
Secondly, one of the methods I'm adding sets a 'FormHasChanged' bool to True... but based on another forum post I read it would seem the 'OnValueChanged' fires once when the page loads and the control populates the value initially... is there a way to modify this behavior? The other post suggested tracking the before and after values... this is far from ideal as I would like to be able to generically add a call to set the bool when the value changes.
The big picture is this:
From a random page's code behind I want to be able to call a function I created like so:
The AddOnChange method loops through all the controls in the passed in control set. For each control, it tries to decide how best to apply an 'onChange' event... ADDING to any existing method defined. The way I'm trying to do this for a RadNumericEtc is something like ://Add the OnChange event to all the appropriate controls on this user control. ControlManager.AddOnChange(this.Controls, "SetDirtyFlag", true);
else if(control is RadNumericTextBox)This way, when I call AddOnChange, the SetDirtyFlag method call would be ADDED to any other method(s) defined to fire when the value changes. The SetDirtyFlag simply sets the 'FormHasChanged' flag to true, without needing to include any other specific logic.
{
(control as RadNumericTextBox).ClientEvents.OnValueChanged = (control as RadNumericTextBox).ClientEvents.OnValueChanged + ";" + onChangeString;
//We also want to avoid user tab to the up and down spinner buttons on any RadNumericTextBox controls.
(control as RadNumericTextBox).ButtonDownContainer.Attributes.Add("tabindex", "-1");
(control as RadNumericTextBox).ButtonUpContainer.Attributes.Add("tabindex", "-1");
}
So my two issues are 1) I can't seem to stack method calls and 2) If the 'OnValueChanged' fires at page load, then the page will ALWAYS think the form has changed... and if I have to track before/after values, then that would require a MASSIVE amount of additional coding...
Thoughts?