GridColumn that supports multiple textbox styles

2 posts, 0 answers
  1. Decisive Computing
    Decisive Computing avatar
    17 posts
    Member since:
    Mar 2015

    Posted 21 May 2017 Link to this post


    Telerik Product and Version AJAX 2017 R2

    Supported Browsers and Platforms

    Any that AJAX supports

    Components/Widgets used (JS frameworks, etc.)


    I often find that I need to have a grid column that allows multiple forms of text input when editing. For example, I might need to have a password entry, or allow for multiple lines. The best part of this example is that as browsers get better at supporting entries like numbers and date/time, this code will automatically adapt itself.

    Here is the code:

    public class GridTextBoxColumn : GridBoundColumn
        #region CTOR
        public GridTextBoxColumn()
        #endregion // CTOR
        #region PROPERTIES
        public TextBoxMode Mode
        #endregion // PROPERTIES
        #region IMPLEMENTATION
        protected override IGridColumnEditor CreateDefaultColumnEditor()
            GridTextBoxColumnEditor editor = new GridTextBoxColumnEditor(this);
            editor.TextBoxMode = Mode;
            return editor;
        #endregion // IMPLEMENTATION


    To use this, put this class in a DLL and then reference it like you do for the regular Telerik controls in your web.config:

            <add tagPrefix="mycode" namespace="MyCode.Controls" assembly="MyCode" />


    The, in your grid, just create a column in your Columns collection like this:

    <mycode:GridTextBoxColumn Mode="Password" />

  2. Eyup
    Eyup avatar
    3383 posts

    Posted 24 May 2017 Link to this post


    Thank you for sharing your specific approach with our community. I've updated your Telerik points as a token of gratitude.

    I just want to insert a general caveat here that using custom controls is beyond our support scope, even when they are inherited directly from Telerik controls:

    Another approach to achieve this requirement is to use a GridTemplateColumn:

    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top