This is a migrated thread and some comments may be shown as answers.

Include Client Script in Custom Control Inheriting RadNumericTextBox

1 Answer 56 Views
ScriptManager and StyleSheetManager
This is a migrated thread and some comments may be shown as answers.
Dhinesh Muthuvel
Top achievements
Rank 1
Dhinesh Muthuvel asked on 13 Feb 2010, 11:18 AM
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>>"));

 

 

}

}

}

1 Answer, 1 is accepted

Sort by
0
Dhinesh Muthuvel
Top achievements
Rank 1
answered on 30 Mar 2010, 01:59 PM
Solved it by implementing the control using Ajax server control instead of server control.
Tags
ScriptManager and StyleSheetManager
Asked by
Dhinesh Muthuvel
Top achievements
Rank 1
Answers by
Dhinesh Muthuvel
Top achievements
Rank 1
Share this question
or