This is a migrated thread and some comments may be shown as answers.

Limit Characters in MultiLine textbox in GridTemplateColumn

1 Answer 392 Views
Grid
This is a migrated thread and some comments may be shown as answers.
P
Top achievements
Rank 1
P asked on 04 Sep 2019, 01:51 PM

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: http://www.aspnet101.com/2009/01/limit-characters-in-multiline-textbox/

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">
            <Columns>               
                <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">
                    <ItemTemplate>                       
                        <asp:TextBox ID="txtMessage1"  TextMode="MultiLine" Text='<%# Bind("Comments") %>'  Width="300px"  Rows="3" MaxLength="500"   runat="server"   />                       
                    </ItemTemplate>
                </telerik:GridTemplateColumn>                 
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>

 

 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 09 Sep 2019, 05:24 AM
Hello,

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

I hope this will prove helpful.

Regards,
Eyup
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.
Tags
Grid
Asked by
P
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or