<telerik:RadNumericTextBox runat="server" ID="txtFirstYear" RenderMode="Lightweight" MaxLength="4" MaxValue="2030" Visible="true" EmptyMessage="" MinValue="1998" CausesValidation="True" Culture="it-IT" DataType="System.Int32">
<NumberFormat DecimalDigits="0" />
</telerik:RadNumericTextBox>
I am using a RadTextBox for a simple messaging form, and if the user leaves a field blank, I use a CustomValidator to set the control IsValid=true. This is great and it uses the invalid style (pink background) and little icon and brings the user's attention to the field.
protected void valMissingFields_ServerValidate(object source, ServerValidateEventArgs args) { txtMessageSubject.Text = txtMessageSubject.Text.Trim(); txtMessageBody.Text = txtMessageBody.Text.Trim(); txtMessageSubject.Invalid = (txtMessageSubject.Text == ""); txtMessageBody.Invalid = (txtMessageBody.Text == ""); args.IsValid = (!txtMessageSubject.Invalid && !txtMessageBody.Invalid); }
I thought the InvalidStyleDuration would make it go away after a few seconds (3000 ms = 3 seconds):
<table cellspacing="0" cellpadding="0" style="width:100%;">
<tr valign="top">
<td style="width:90px;">
Message:
</td>
<td>
<telerik:RadTextBox ID="txtMessageBody" runat="server"
Width="100%" MaxLength="1000" TextMode="MultiLine" Rows="25"
InvalidStyleDuration="3000"
EnableEmbeddedSkins="false" Skin="MyCustomSkin"></telerik:RadTextBox><br />
</td>
<td style="width:20px; text-align:right;">
<span class="required">*</span>
</td>
</tr>
</table>
But it does not.
Instead, the user is stuck typing into the text box with bright red bold lettering.
Am I misunderstanding how this works?
As a workaround, I thought I'd use the OnClientEvents for OnValueChanging to make it switch the Invalid indication off, but apparently that event only fires when focus moves away from the control.
I have a Weight column in my RadGrid, which I'm using a CustomValidationFunction, which is working fine. It disallows invalid values.
But I want blank, 0 (or below) to be set automatically to the minimum value allowed, rather than making the user put it in manually. How can I accomplish this?
Here is the column I'm validating:
<telerik:GridTemplateColumn UniqueName="Weight" HeaderText="Weight" DataField="Weight" AllowFiltering="false">
<ItemTemplate><%# Eval("Weight") %></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="WeightAmt" runat="server" />
<asp:CustomValidator runat="server" ID="WeightValidator" EnableClientScript="true" ControlToValidate="WeightAmt"
ClientValidationFunction="WeightValidator" />
</EditItemTemplate>
</telerik:GridTemplateColumn>
And here is the validation function as it currently stands:
function WeightValidator(sender, args) {
var thisWeight = parseInt(args.Value);
if (thisWeight > maxWeight) {
sender.textContent = "Weight may not be larger than " + maxWeight;
args.IsValid = false;
return;
}
if (thisWeight < 1) {
thisWeight = minWeight;
arguments[0].parentElement.parentElement.getElementsByTagName("input")[0].textContent = minWeight.toString();
}
if (thisWeight < minWeight) {
sender.textContent = "Weight may not be smaller than " + minWeight;
args.IsValid = false;
return;
}
args.IsValid = true;
}
Debug indicates the `arguments` statement sets the value, but this isn't actually tied to anything on the page, so it gets lost. The only place I see the cell value is in a hidden `div` (`style="display: none")` and I don't see any way of changing that.
In searching for a solution, I see it is recommended to edit the `innerHTML`, but that doesn't even contain the value I'm wanting to edit.
Is there a good way for validation to correct data errors that it can instead of just calling it invalid?
I have added a RadMaskedTextBox to a form. My layout uses bootstrap. All of my other controls have the label at the top, but when I add the RadMaskedTextBox , the label goes to the left. This happens whether I use the asp label or the built in label for the control.
<telerik:RadMaskedTextBox ID="rmtPhone" runat="server" RenderMode="Auto" Mask="+1 (###) ###-####" Label="Phone"></telerik:RadMaskedTextBox>
Does anyone have a solution to move the label to the top?
Hello there!
I've got a DAT file that I am trying to display its content in a RadTextBox.
I've done that, however the problem is the formatting. I will be sharing screenshots of how I want it to be formatted and how it is actually formatting it. I've spent a few hours looking with no results therefore I hope a way exits to do this.
The image DatFile.png contains a screenshot of how my file looks like, with vertical and horizontal scrollbars to keep the text formatted in a readable way and only wrapping the text when the line is finished. If the line is too long, an horizontal scroll allows you to navigate and see the rest of the line without actually wrapping it to a new line and making it very hard to read.
The image code.png contains a screenshot of how it is being formatted in my RadTextBox.
The code below is the code of the RadTextBox on my aspx page
<telerik:RadTextBox ID="RadTextBox1" Runat="server" ReadOnly="True" TextMode="MultiLine" Resize="Both" Text='<%# Eval("FichierGrtn") %>' Width="1750px" Height="800px">
</telerik:RadTextBox>
After inserting the code above, I have just realized that the text box you guys used to insert the colored code is exactly the same thing I want for my text box to behave. I have included a screenshot for that as well under the name of "forums.png".
Please check all the attached screenshots in order to have a better idea regarding the problem I'm facing.
Thank you!
Hello
I have a asp:button with event "onClientClick" calling radAlert. The idea being if no checkbox from a list is selected, then I show error message saying no checkbox selected. If something is checked, then I show an alert warning side effects of performing this action to users.
Using normal windows alert my code worked fine. I changed it to radAlert and I get the following error when button click method returns true. any ideas why? Thanks
Please note I have included script manager tag in site master and noticed that skinManager made no difference.
Telerik.Web.UI is version 2020.3.915.45
error:
Uncaught TypeError: Cannot read properties of null (reading 'click')
at Sys.UI.DomEvent._removeHandler (ScriptResource.axd?d=l-HRKS2UdUh-FV8pLZQt_8PO1KoV-nv3gFy0dGRtji95LKfVBi92Y5fapUBBxhFsoFd78m3hPynnuWeinQLEFSTurV2yHCVYQ4Yb8UUeyxc0W4nob0uNxUaSqn5y-HKGhZWdur9WRfeM3AuWWX3uN_SRx5d9J5ymT9svRP3TrhY1&t=49337fe8:5:58766)
at Sys.UI.DomEvent.removeHandler (ScriptResource.axd?d=l-HRKS2UdUh-FV8pLZQt_8PO1KoV-nv3gFy0dGRtji95LKfVBi92Y5fapUBBxhFsoFd78m3hPynnuWeinQLEFSTurV2yHCVYQ4Yb8UUeyxc0W4nob0uNxUaSqn5y-HKGhZWdur9WRfeM3AuWWX3uN_SRx5d9J5ymT9svRP3TrhY1&t=49337fe8:5:58674)
at ......
my code:
The asp:button looks like this:
<asp:Button Text="Baseline Permissions" runat="server" ID="btnRemapTitlesToRoles" OnClientClick="return hasTitlesSelectedForRemap();" OnClick="btnRemapTitlesToRoles_Click" CssClass="btn" />
<script type="text/javascript">
(function (global, undefined) {
var demo = {};
global.$dialogsDemo = demo;
Sys.Application.add_load(function () {
//attach a handler to radio buttons to update global variable holding image url
$telerik.$('input:radio').bind('click', function () {
demo.imgUrl = $telerik.$(this).val();
});
});
global.alertCallBackFn = alertCallBackFn;
function alertCallBackFn(arg) {
// empty place holders
return true;
}
})(window);
// this is the method called by asp:button
function hasTitlesSelectedForRemap() {
var isAnyTitleChecked = $('#' + '<%= titlesGridView.ClientID %>' + ' input:checkbox').is(":checked");
var message = '';
var title = '';
if (!isAnyTitleChecked) {
message = 'Please select titles first';
title = 'selection missing';
}
else {
message = 'Baselining permissions will reset permissions for all users of selected titles. Please proceed with caution.';
title = 'Remap warning';
}
radalert(message, 330, 180, title, alertCallBackFn, $dialogsDemo.imgUrl);
return isAnyTitleChecked;
}
function selectAllRolesForTitles(sender) {
var isChecked = sender.checked;
$('#' + '<%= titlesGridView.ClientID %>' + ' input:checkbox').each(function () {
$(this).prop("checked", isChecked);
});
}
</script>
If I attempt to ajaxify an asp.net textbox using RadAjaxManager, obviously, a div with a RadAjaxPanel class surround the div with the "form-floating" class.
When that situation occurs the placeholder duplicates 11px above the current one. In addition, when you put the cursor in the textbox field, the floating label doesn't "float". It remains where it is and conflicts with the newly entered text in the textbox.
Any suggestions?
Dana
If IsNothing(Sfo.DatumletztPrüfung) = False AndAlso IsDate(Sfo.DatumletztPrüfung) = True Then
RadDateLetztePrüfung.DateInput.SelectedDate = Convert.ToDateTime(Sfo.DatumletztPrüfung)
RadDateLetztePrüfung.Calendar.SelectedDate = Now()
End If
RadDateLetztePrüfung.SelectedDate = Convert.ToDateTime(Sfo.DatumletztPrüfung)