I was trying to include the javascript for client events for RadNumericTextBox, however eveytime I use the custom control i get error saying undefined function name.
public class CustomRadNumericTextBoxControl : RadNumericTextBox, IPostBackEventHandler, INamingContainer
{
private string OnKeyPressFunctionName = "OnKeyPress";
protected override void OnPreRender(EventArgs e)
{
RegisterJavascripts();
this.Type = NumericType.Currency;
this.Culture = CultureInfo.CurrentCulture;
this.DataType = System.Type.GetType("System.Decimal");
this.NumberFormat.AllowRounding = true;
this.ClientEvents.OnKeyPress = OnKeyPressFunctionName;
base.OnPreRender(e);
EnsureChildControls();
}
public void RegisterJavascripts()
{
Page.ClientScript.RegisterClientScriptInclude(
Guid.NewGuid().ToString(),
Page.ClientScript.GetWebResourceUrl(GetType(),
"<<Embedded javascript resource file name>>"));
}
}
}