Limit Characters in MultiLine textbox in GridTemplateColumn

2 posts, 0 answers
  1. P
    P avatar
    1 posts
    Member since:
    Sep 2019

    Posted 04 Sep 2019 Link to this post

    I am trying to add "Comment" column in the grid which will display "chars remaining" as user types as well as limit max characters allowed in the textbox.

    something like showed here:

    My grid looks like this: 


    <telerik:RadGrid RenderMode="Lightweight" AutoGenerateColumns="false"   MasterTableView-DataKeyNames="AttachmentID"    OnNeedDataSource="GridView1_NeedDataSource"  AllowAutomaticUpdates="true"      ID="GridView1"     AllowSorting="True" runat="server" >
            <MasterTableView AllowSorting="true">
                    <telerik:GridBoundColumn DataField="AttachmentID" UniqueName="AttachmentID" Visible="false" />
                    <telerik:GridBoundColumn   AllowSorting="true"   DataField="CurriculamYear" UniqueName="CurriculamYear"     HeaderText="Curriculum Year"/> 
                    <telerik:GridHyperLinkColumn  AllowSorting="true" DataNavigateUrlFields="Path" DataNavigateUrlFormatString="{0}"   DataTextField="Name" UniqueName="Name"  HeaderText="Document Type"/> 
                    <telerik:GridBoundColumn  AllowSorting="true"   DataField="FileName" UniqueName="FileName"  HeaderText="File Name"/> 
                    <telerik:GridBoundColumn  AllowSorting="true"   DataField="CreateDate" UniqueName="CreateDate"  HeaderText="Upload Date and Time"/> 
                    <telerik:GridTemplateColumn HeaderText="Comments"  UniqueName="Comments">
                            <asp:TextBox ID="txtMessage1"  TextMode="MultiLine" Text='<%# Bind("Comments") %>'  Width="300px"  Rows="3" MaxLength="500"   runat="server"   />                       



  2. Eyup
    Eyup avatar
    3953 posts

    Posted 09 Sep 2019 Link to this post


    You can use telerik:RadTextBox to achieve this automatically:
    <telerik:RadTextBox ... MaxLength="5"   runat="server"   />

    I hope this will prove helpful.

    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top