Include Client Script in Custom Control Inheriting RadNumericTextBox

2 posts, 0 answers
  1. Dhinesh Muthuvel
    Dhinesh Muthuvel avatar
    6 posts
    Member since:
    Feb 2010

    Posted 13 Feb 2010 Link to this post

    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>>"));

     

     

    }

    }

    }

  2. Dhinesh Muthuvel
    Dhinesh Muthuvel avatar
    6 posts
    Member since:
    Feb 2010

    Posted 30 Mar 2010 Link to this post

    Solved it by implementing the control using Ajax server control instead of server control.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top