We've upgraded 2 weeks ago to the new Telerik version and now the clients have noticed a weird behaviour that I can't seem to solve.
I have a repeater and in each row there's a numerictextbox. The user can go to the next line with the tab and enter key.
With the tab key there aren't any problems. When the repeater is saved, the values of the radnumerictextbox match with the input.
When the enter key is used, the user doesn't see any problems. But the moment that the data is saved, the value of the numerictextbox is changed to the maxvalue when there isn't a digital digit in the user's input. E.g. the maxvalue is 10 and the user enters 6 it will be saved as 10 and if the user enters 6.5 then 6.5 will be saved.
When I debug, I notice that LastSetTextBoxValue is the only attribute that has the correct value.
The mark-up of the numerictextbox in the HTML-page in the repeater is as follows:
I use the following javascript to check the value of the textbox and validate the keypress..
In the code-behind the following settings are added:
Can anybody help me solve this problem?
I have a repeater and in each row there's a numerictextbox. The user can go to the next line with the tab and enter key.
With the tab key there aren't any problems. When the repeater is saved, the values of the radnumerictextbox match with the input.
When the enter key is used, the user doesn't see any problems. But the moment that the data is saved, the value of the numerictextbox is changed to the maxvalue when there isn't a digital digit in the user's input. E.g. the maxvalue is 10 and the user enters 6 it will be saved as 10 and if the user enters 6.5 then 6.5 will be saved.
When I debug, I notice that LastSetTextBoxValue is the only attribute that has the correct value.
The mark-up of the numerictextbox in the HTML-page in the repeater is as follows:
<
telerik:RadNumericTextBox
ID
=
"rtbPunten"
runat
=
"server"
Width
=
"50px"
Type
=
"Number"
IncrementSettings-InterceptArrowKeys
=
"false"
IncrementSettings-InterceptMouseWheel
=
"false"
MinValue
=
"0"
DbValue='<%#Container.DataItem("punten")%>'
ToolTip='<%# "punt " & Container.DataItem("nickname")%>' />
I use the following javascript to check the value of the textbox and validate the keypress..
function HandleError(sender, eventArgs) {
switch (eventArgs.get_reason()) {
case 1: // Parsing error
$find(sender.get_id())._textBoxElement.value = $find(sender.get_id())._textBoxElement.value.replace(",", "") + ",";
eventArgs.set_cancel(true);
break;
case 2: // Out of range
setTimeout(function () {
sender.clear();
}, 10);
document.getElementById(sender.get_id().replace("rtbPunten", "errPunten")).style.display = "";
eventArgs.set_cancel(false);
break;
}
}
function onKeypress(sender, eventArgs, R) {
document.getElementById(sender.get_id().replace("rtbPunten", "errPunten")).style.display = "none";
var r = eventArgs.get_keyCode();
if (r == 13) {
var s = sender.get_id().split("_R_ctl")[1].replace("_rtbPunten", "");
s = parseFloat(s) + 1;
var n = $find(R + "_ctl" + formatNumber(s, 2) + "_rtbPunten");
if (n) {
setTimeout(function () {
n.focus();
n.selectAllText();
}, 10);
}
}
}
In the code-behind the following settings are added:
Dim ptn As RadNumericTextBox = CType(ri.FindControl("rtbPunten"), RadNumericTextBox)
ptn.NumberFormat.DecimalDigits = NumberOfDigits
ptn.MaxValue = maxPoints
ptn.Culture = CultureInfo.GetCultureInfo("nl-BE")
ptn.ClientEvents.OnError = "HandleError"
ptn.ClientEvents.OnKeyPress = "keyPress"
ptn.ClientEvents.OnValueChanged = "puntChanged"
If ptn.Value < CDbl(hdMax.Value) Then ptn.ForeColor = Drawing.Color.Red
Can anybody help me solve this problem?