I have developed a page where I have used the following controls:
RadGrid
RadTabStrip
RadDatePicker
RadNumericTextBox
On this page caching is enabled so every control I use here on the page I need to set the following properties:
I have added the scripts of the controls dynamically in my MasterPage via the following code snippet:
The above code section works because all other controls work how they should be except the RadNumericTextBox.
On that page which I have developed I have a RadTabStrip with two tabs. In the second tab I have rendered the RadNumericTextBox via the codebehind with the following code:
Which have some client events which are not worth to mention because they validate if the user presses ',' that this is not allowed in the RadNumericTextBox and when the user leaves the RadNumericTextBox and it is empty that the value is reset to the default (minimal value).
The problem is that sometimes the RadNumericTextBox works but when I press CTRL + F5 or just restart my webpage the RadNumericTextBox does not work anymore. Somehow client events are not triggered when the user interacts with this RadNumericTextBox.
I have validated that the $create method is rendered on the page and also is called. Based on this idea (because we had a similair problem before with the RadTabStrip) I have decided to add an additional client event: onNumericClientLoad which simulates again the $create method. Somehow this doesn't work either.
$create(Telerik.Web.UI.RadNumericTextBox, {
"_displayText": sender.get_value(),
"_focused": false,
"_initialValueAsText": sender.get_value(),
"_postBackEventReferenceScript": sender._postBackEventReferenceScript,
"_skin": sender._skin,
"_validationText": sender.get_value(),
"clientStateFieldID": sender._clientStateFieldID,
"enabled": true,
"incrementSettings": { InterceptArrowKeys: true, InterceptMouseWheel: true, Step: 1 },
"maxValue": sender.get_maxValue(),
"minValue": sender.get_minValue(),
"numberFormat": { "DecimalDigits": 0, "DecimalSeparator": ",", "CultureNativeDecimalSeparator": ",", "GroupSeparator": "", "GroupSizes": 3, "NegativePattern": "-n", "NegativeSign": "-", "PositivePattern": "n", "AllowRounding": false, "KeepNotRoundedValue": false, "KeepTrailingZerosOnFocus": false, "NumericPlaceHolder": "n" },
"styles": { HoveredStyle: ["width:160px;", "riTextBox riHover"], InvalidStyle: ["width:160px;", "riTextBox riError"], DisabledStyle: ["width:160px;", "riTextBox riDisabled"], FocusedStyle: ["width:160px;", "riTextBox riFocused"], EmptyMessageStyle: ["width:160px;", "riTextBox riEmpty"], ReadOnlyStyle: ["width:160px;", "riTextBox riRead"], EnabledStyle: ["width:160px;", "riTextBox riEnabled"], NegativeStyle: ["width:160px;", "riTextBox riNegative"] }
}, { "keyPress": onKeyPress, "blur": onBlur }, null, $get(sender.get_id()));
I'm really lost now why this is not working, I hope someone can help me to get the client events working with this RadNumericTextBox.
Details:
Development Environment: Visual Studio 2010 Professional
Framework: .NET 4.0
Controls: ASP.NET Controls
Version: 2012.2.912.40
RadGrid
RadTabStrip
RadDatePicker
RadNumericTextBox
On this page caching is enabled so every control I use here on the page I need to set the following properties:
EnableEmbeddedBaseStylesheet =
false
;
EnableEmbeddedScripts =
false
;
EnableEmbeddedSkins =
false
;
RegisterWithScriptManager =
false
;
I have added the scripts of the controls dynamically in my MasterPage via the following code snippet:
var scripts =
new
List<ScriptReference>();
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadGrid)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadTabStrip)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadMultiPage)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadComboBox)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadInputManager)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadFilter)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadMenu)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadContextMenu)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadInputControl)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadMaskedTextBox)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadToolTip)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadToolTipManager)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadNumericTextBox)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadUpload)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadAsyncUpload)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadTreeView)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadTextBox)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadCalendar)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadDatePicker)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadDateTimePicker)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadMonthYearPicker)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadTimeView)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadTimePicker)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadDateInput)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadScriptManager)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadAjaxManager)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadToolBar)));
scripts.AddRange(ScriptObjectBuilder.GetScriptReferences(
typeof
(RadDate)));
foreach
(var script
in
scripts)
RadScriptManager1.Scripts.Add(script);
The above code section works because all other controls work how they should be except the RadNumericTextBox.
On that page which I have developed I have a RadTabStrip with two tabs. In the second tab I have rendered the RadNumericTextBox via the codebehind with the following code:
var ctl =
new
RadNumericTextBox();
ctl.ID =
"RandomId"
;
ctl.NumberFormat.AllowRounding =
false
;
ctl.NumberFormat.DecimalDigits = 0;
ctl.NumberFormat.GroupSeparator =
""
;
ctl.MinValue = 1;
ctl.MaxValue =
int
.MaxValue;
ctl.ClientEvents.OnKeyPress =
"onKeyPress"
;
ctl.ClientEvents.OnBlur =
"onBlur"
;
ctl.Value = 1;
ctl.EnableEmbeddedBaseStylesheet =
false
;
ctl.EnableEmbeddedScripts =
false
;
ctl.EnableEmbeddedSkins =
false
;
ctl.RegisterWithScriptManager =
false
;
Which have some client events which are not worth to mention because they validate if the user presses ',' that this is not allowed in the RadNumericTextBox and when the user leaves the RadNumericTextBox and it is empty that the value is reset to the default (minimal value).
The problem is that sometimes the RadNumericTextBox works but when I press CTRL + F5 or just restart my webpage the RadNumericTextBox does not work anymore. Somehow client events are not triggered when the user interacts with this RadNumericTextBox.
I have validated that the $create method is rendered on the page and also is called. Based on this idea (because we had a similair problem before with the RadTabStrip) I have decided to add an additional client event: onNumericClientLoad which simulates again the $create method. Somehow this doesn't work either.
$create(Telerik.Web.UI.RadNumericTextBox, {
"_displayText": sender.get_value(),
"_focused": false,
"_initialValueAsText": sender.get_value(),
"_postBackEventReferenceScript": sender._postBackEventReferenceScript,
"_skin": sender._skin,
"_validationText": sender.get_value(),
"clientStateFieldID": sender._clientStateFieldID,
"enabled": true,
"incrementSettings": { InterceptArrowKeys: true, InterceptMouseWheel: true, Step: 1 },
"maxValue": sender.get_maxValue(),
"minValue": sender.get_minValue(),
"numberFormat": { "DecimalDigits": 0, "DecimalSeparator": ",", "CultureNativeDecimalSeparator": ",", "GroupSeparator": "", "GroupSizes": 3, "NegativePattern": "-n", "NegativeSign": "-", "PositivePattern": "n", "AllowRounding": false, "KeepNotRoundedValue": false, "KeepTrailingZerosOnFocus": false, "NumericPlaceHolder": "n" },
"styles": { HoveredStyle: ["width:160px;", "riTextBox riHover"], InvalidStyle: ["width:160px;", "riTextBox riError"], DisabledStyle: ["width:160px;", "riTextBox riDisabled"], FocusedStyle: ["width:160px;", "riTextBox riFocused"], EmptyMessageStyle: ["width:160px;", "riTextBox riEmpty"], ReadOnlyStyle: ["width:160px;", "riTextBox riRead"], EnabledStyle: ["width:160px;", "riTextBox riEnabled"], NegativeStyle: ["width:160px;", "riTextBox riNegative"] }
}, { "keyPress": onKeyPress, "blur": onBlur }, null, $get(sender.get_id()));
I'm really lost now why this is not working, I hope someone can help me to get the client events working with this RadNumericTextBox.
Details:
Development Environment: Visual Studio 2010 Professional
Framework: .NET 4.0
Controls: ASP.NET Controls
Version: 2012.2.912.40