<telerik:RadNumericTextBox ID="rntMyTextBox" Type="Number" runat="server"
MaxValue="997" EnabledStyle-HorizontalAlign="Right" Font-Size="Small" MaxLength="3"
MinValue="0" Width="153px" FocusedStyle-PaddingRight="1px" ShowSpinButtons="true"
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.
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:
//Add the OnChange event to all the appropriate controls on this user control.
ControlManager.AddOnChange(this.Controls, "SetDirtyFlag", true);
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 :
else if(control is RadNumericTextBox)
(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");
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.
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...