Radgrid GridBoundColumn Multiline MaxLength

4 posts, 0 answers
  1. Myriam
    Myriam avatar
    153 posts
    Member since:
    Sep 2008

    Posted 11 Feb 2009 Link to this post

    I have a radgrid. When I add a record, in the edit mode, I would like to set a maxlength to my gridBoundColumn which is multiline. I saw that I can't do that, does it have a workaround for this?


  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Feb 2009 Link to this post


    I hope you are trying to set the MaxLength of the TextBox when the Grid is in edit mode. If so you can either try setting in the aspx or in the code behind as shown below.


    telerik:GridBoundColumn DataField="ProductName"  MaxLength="5"   HeaderText="ProductName"   UniqueName="ProductName"



    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
         // in insert mode 
            if ((e.Item is GridEditFormInsertItem) && (e.Item.OwnerTableView.IsItemInserted)) 
                GridEditFormInsertItem insertItem = (GridEditFormInsertItem)e.Item; 
                TextBox txtbx = (TextBox)insertItem["ProductName"].Controls[0]; 
                txtbx.MaxLength = 5; 
          //in edit mode 
            if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode)) 
                GridEditFormItem editItem = (GridEditFormItem)e.Item; 
                TextBox txtbx = (TextBox)editItem["ProductName"].Controls[0]; 
                txtbx.MaxLength = 5; 

  3. surya
    surya avatar
    9 posts
    Member since:
    Dec 2015

    Posted 20 Jan 2016 Link to this post

    Hello Shinu,

    I am facing the same issue.I tried both the ways ,neither of it worked in my case.I am using Version 2013.My req is to allow user to enter only 10 characters.i am using radgrid batch editng mode cell.could you please help with that..


  4. Eyup
    Eyup avatar
    3320 posts

    Posted 25 Jan 2016 Link to this post

    Hello Surya,

    Please note that Batch editing mode is different than other modes. You can find a detailed explanation in the following section:

    You can find related information for implementing Batch editing with templates in this article:

    Hope this helps.

    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 Feedback Portal and vote to affect the priority of the items
Back to Top