GridMaskedColumn

5 posts, 0 answers
  1. David Borneman
    David Borneman avatar
    37 posts
    Member since:
    Jul 2007

    Posted 01 Feb 2008 Link to this post

    I am using the following GridMaskedColumn in my grid. It works great if I want to store my phone numbers in the DB with the special characters but I don't. So I'm stripping the extra characters of the mask off before inserting so a phone is stored as 9999999999 rather than (999) 999-9999.

    My first question is why does this write the mask to the database in the first place? A mask is a mask - it should write what's IN the mask and not the mask itself.

    Second question - How can I get DataFormatString to work when this column is displayed. Currently my phones are displayed literally as (###) ###-####" . The DataFormatString is not working.

    <
    telerik:GridMaskedColumn Mask="(###) ###-####"
    UniqueName="Phone"
    HeaderText="Phone"
    DataField="Phone"
    CurrentFilterFunction="EqualTo"
    DataFormatString="(###) ###-####"
    FilterListOptions="VaryByDataType"
    ForceExtractValue="None">
    <ItemStyle Width="100px" />
    </telerik:GridMaskedColumn>

  2. David Borneman
    David Borneman avatar
    37 posts
    Member since:
    Jul 2007

    Posted 01 Feb 2008 Link to this post

    Nevermind I fixed this myself. I had the format wrong for one thing and I brought the phone datafield in as a cast to int so the format would work on it. I still don't think the mask should have to be stripped from the value before you can insert to the DB though.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Nicolo
    Nicolo avatar
    9 posts
    Member since:
    Aug 2012

    Posted 05 Feb 2008 Link to this post

    Hello David
    You wrote it is necessary to cast into int for DataFormatString working. How did you it and how does your GridMaskedColumn definition look now?
    Thanks
  5. David Borneman
    David Borneman avatar
    37 posts
    Member since:
    Jul 2007

    Posted 05 Feb 2008 Link to this post

    <

    asp:SqlDataSource runat="server"
                ID="sdsPhones" 
                ConnectionString="<%$ ConnectionStrings:ECMConnection %>"
                SelectCommand="SELECT p.PhoneID, p.PartyID, CAST(p.Phone AS bigint)as Phone, p.Extension, p.Description, t.PhoneTypeName FROM Phone p, PhoneType t WHERE p.PartyID=@PartyID AND p.PhoneTypeID = t.PhoneTypeID">
                <SelectParameters>
                    <asp:SessionParameter Name="PartyID" SessionField="PartyID" />
                </SelectParameters>
    </asp:SqlDataSource>


    <

    telerik:radmaskedtextbox runat="server"
                
    id="newPhone" 
                
    PromptChar="_" 
                
    Skin="Default" 
                
    Mask="(###) ###-####">
    </telerik:radmaskedtextbox>

    You have to cast the phone number as a bigint in order for the mask to work.

  6. Nicolo
    Nicolo avatar
    9 posts
    Member since:
    Aug 2012

    Posted 05 Feb 2008 Link to this post

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