Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
15 views

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.

 

 
Peter
Top achievements
Rank 1
 asked on 22 Jan 2024
1 answer
16 views
I inherited a .NET website using RadAjax.Net2.dlls. Currently only supported in IE compatibility mode from my understanding.  I would like to upgrade to a version that works in current browsers.  The website is using .NET 2.0 but we are upgrading the framework to 2.8 if possible.   I appreciate any recommendations on upgrade path.  
Rumen
Telerik team
 answered on 15 Jan 2024
1 answer
49 views

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?

Vasko
Telerik team
 answered on 16 Nov 2023
1 answer
29 views

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?

Vasko
Telerik team
 answered on 03 Nov 2023
1 answer
163 views

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!

Doncho
Telerik team
 answered on 09 Nov 2022
10 answers
434 views
hi, 
i am using multiple line  radtextbox in many user control on my project . enter key is not working with radtextbox in some user controls . 
Sathish
Top achievements
Rank 1
Iron
Iron
 answered on 17 Oct 2022
0 answers
772 views

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" /> 
the code that's called looks like this:

 <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>

 

Josh
Top achievements
Rank 1
 asked on 16 Jul 2022
2 answers
133 views

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

Dana Cobb
Top achievements
Rank 1
Iron
 answered on 29 Jun 2022
1 answer
202 views
Hello,
i have a webform with 4 RadDatePickers. In one control i want to have two different dates.  In the dateInput-control is a date from a database and in the calender-control should be now.
The code look like this:

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

But the controls are empty. Only when is set the date to the RadDatePicker-Control:
 RadDateLetztePrüfung.SelectedDate = Convert.ToDateTime(Sfo.DatumletztPrüfung)
The Date is shown.
What have i made wrong?

Kind regards
Jens

Doncho
Telerik team
 answered on 07 Dec 2021
1 answer
141 views

Hi, I'm trying to create a dynamic rad grid (two columns) for batch edit where one column can have different control based on a condition. Basically, it should look like this once click to edit the cell.

Value 1	Dropdown
Value 2	TextBox
Value 3	DatePicker
Value 4	Checkbox
Value 5	TextBox

Can anyone share a sample code for this? 

Thank You

Doncho
Telerik team
 answered on 16 Jun 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?