masked text on a rad grid

5 posts, 0 answers
  1. Ivo
    Ivo avatar
    15 posts
    Member since:
    Feb 2007

    Posted 05 May 2008 Link to this post

    Hello,
    I would like to check if there is a direct way to display masked text on a rad grid.
    There is a telerik:GridMaskedColumn, but it looks like it works only for edit mode. We can use template with RadMaskedTextBox control, but it doesn’t look consistent with the other columns.

    Thanks,
    Ivo
  2. Kiara
    Kiara avatar
    309 posts
    Member since:
    Jul 2006

    Posted 05 May 2008 Link to this post

    Indeed the GridMaskedColumn type will filter the user entry when you edit a particular item in the grid. The other option I discovered is to put directly RadMaskedTextBox in item template of template column. Choose the approach in accordnace with your needs.

    Kiara


  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Andy Green
    Andy Green avatar
    120 posts
    Member since:
    Jul 2009

    Posted 05 May 2010 Link to this post

    Hi

    I have the same requirement - How was this solved in the end?

    Andy
  5. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 10 May 2010 Link to this post

    Hello guys,

    The most straightforward approach is to have a read-only RadMaskedTextBox in the ItemTemplate of a GridTemplateColumn, and an editable RadMaskedTextBox in the EditItemTemplate.

    The other option to go with would be to use a regular GridMaskedColumn, but to manually mask your data values after the grid is bound. You can use RadGrid's ItemDataBound event for that:

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem item = (GridDataItem)e.Item;
            string originalValue = item["MaskedColumnUniqueName"].Text;
            //implement masking logic here and update originalValue to masked value
            item["MaskedColumnUniqueName"].Text = originalValue;
        }
    }


    Kind regards,
    Veli
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Andy Green
    Andy Green avatar
    120 posts
    Member since:
    Jul 2009

    Posted 13 May 2010 Link to this post

    Thanks

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