RadMaskedTextBox: Multiline mask

10 posts, 0 answers
  1. Ferdinand van der Veen
    Ferdinand van der Veen avatar
    3 posts
    Member since:
    Mar 2010

    Posted 28 Feb 2011 Link to this post

    I would like to use the RadMaskedTextBox in the following scenario:

    My user has a multiline textbox in which he can enter text. This text has a maximum length per line and
    must match certain criteria. In this  case it can be any character. When I set the text property of my
    maskedtextbox the only thing that appears is my mask. I already tried to set the defaultmask, but when
    the user clicks the textbox the default mask is applied. How  should I use the RadMaskedTextBox.
    The code I am using is posted below

    <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" />
             
            <telerik:RadMaskedTextBox
                Width="300px"
                Height="80px"
                ID="RadMaskedTextBox1"
                runat="server"
                Label="Masked"
                TextMode="MultiLine"
                Mask = "aaa\r\naaa"
                TextWithLiterals = "123\r\n456"
                />
             
            <br />
            <telerik:RadTextBox
                Width="300px"
                Height="80px"
                ID="RadTextBox1"
                runat="server"
                Label="Normal"
                TextMode="MultiLine"
                Text = "123 456"
            />
        </div>
        </form>
    </body>
    </html>
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 01 Mar 2011 Link to this post

    Hello,

    Check out the following help article which describes how can create multi-line  RadMaskedTextBox.
    Multi-Line Text Boxes

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ferdinand van der Veen
    Ferdinand van der Veen avatar
    3 posts
    Member since:
    Mar 2010

    Posted 01 Mar 2011 Link to this post

    I already tried that, but with no succes. My problem is that when my user types some text, saves it and then want to edit it, all text in the MaskedTextBox is gone. When I save the page again, it is also gone in the database. I tried to reproduce it by making a simple page with just two textboxes on it and setting the text.
  5. Nikita Gourme
    Nikita Gourme avatar
    318 posts
    Member since:
    May 2006

    Posted 04 Mar 2011 Link to this post

    What do you mean by "my user types, saves the text and then edits it"? What the save process is, is it some kind of your custom saving or you rely on the viewstate of the controls when the page is posted to the server? Shedding more light would be useful for further advice.
  6. Ferdinand van der Veen
    Ferdinand van der Veen avatar
    3 posts
    Member since:
    Mar 2010

    Posted 07 Mar 2011 Link to this post

    I save the contents of the MaskedTextbox to a database. When I check the record in the database it's correctly saved (the value in the database is the same as the value I entered). For instance I type:

    line1
    line2


    When I use the setValue property of the MaskedTextbox, the only thing that shows is the Mask. The text is correctly read from the database (I checked that with a breakpoint), but nothing appears in the MaskedTextbox. When I store the value of the MaskedTextbox again, it's stored as an empty value.
  7. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 10 Mar 2011 Link to this post

    Hello Ferdinand,

    Could you please post your aspx page markup code with the related javascript code and code behind file. Thus we will be able to gather more details about your scenario, create a simple project based on your code and provide you with more to-the-point answer.

    Looking forward for your reply.

    All the best,
    Radoslav
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  8. Eric
    Eric avatar
    24 posts
    Member since:
    Jan 2008

    Posted 15 Mar 2011 Link to this post

    Hi,

    I cannot set the Text property of the below RadMaskedTextBox control in the code behind if the TextMode is MultiLine. If the TextMode is SingleLine it works well.
    <telerik:RadMaskedTextBox ID="txtPhone" Runat="server"
        Height="100px" EmptyMessage="Contact Phones" Width="500px"
        TextMode="MultiLine" Mask="Phone1: (###) ###-####    Phone2: (###) ###-####  \r\nPhone3: (###) ###-####    Phone4: (###) ###-####  \r\nPhone5: (###) ###-####    Phone6: (###) ###-####  \r\nPhone7: (###) ###-####    Phone8: (###) ###-####  \r\nPhone9: (###) ###-####" Rows="3">
    </telerik:RadMaskedTextBox>

    txtPhone.Text = "123456789012345678901234567890";

    Thank you...
  9. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 18 Mar 2011 Link to this post

    Hi Eric,

    I tested the scenario which you describe and I reproduced the unwanted behaviour. Our developers are aware and they will start working on the resolution of this issue.

    Best wishes,
    Radoslav
    the Telerik team
  10. Eric
    Eric avatar
    24 posts
    Member since:
    Jan 2008

    Posted 12 Apr 2011 Link to this post

    Hi, when is the bug fix scheduled? Is it going to be in the next release?

    Thank you...
  11. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 12 Apr 2011 Link to this post

    Hello Eric,

    Our developer fixed the described issue and the SP1, which will be released till the end of the week contains the fix.
    On the following links you could find instructions how to use the hotfix dlls and how to upgrade Telerik's RadControls to another version:
    http://www.telerik.com/help/aspnet-ajax/installusinghotfix.html
    http://www.telerik.com/support/kb/aspnet-ajax/general/updating-radcontrols-for-asp-net-to-another-version-or-license.aspx

    Greetings,
    Radoslav
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017