We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Multiline edit in grid

Hello,

i need to edit text field with a multiline textbox. How can i do to make it in a grid ?

Thank you

1 Reply

PK Prasanna Kumar Viswanathan Syncfusion Team November 28, 2016 12:21 PM UTC

Hi Nicolas, 

Thanks for contacting Syncfusion support. 

To have multiline input text box in editing,  use textarea html control in the inline editing of grid. It is achieved by the editTemplate property.  

In EditTemplate Create event we will create the textarea element for CustomerID column. 
 
Find the code example, screenshot and sample:  
 
 
<ej:Grid ID="Grid" runat="server" AllowPaging="True"> 
        <Columns> 
                --------------------------------- 
               <ej:Column Field="CustomerID" HeaderText="Customer ID" Width="90"> 
                    <ValidationRule> 
                        <ej:KeyValue Key="required" Value="true" /> 
                    </ValidationRule> 
                    <EditTemplate Create="create" Read="read" Write="write" /> 
                </ej:Column> 
                --------------------------------- 
         <EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True"></EditSettings> 
          <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings> 
        </ej:Grid>  
<script type="text/javascript"> 
   function create() { 
        return "<textarea class='text' rows='4' cols='50'>{{:CustomerID}}</textarea>"; 
    } 
 
    function read(args) { 
        return args.val(); 
    } 
    function write(args) { 
        args.element.css("width", "100%"); 
    }</script> 
</asp:Content> 
 
 
Screenshot:  
 
 
 

Refer to the Help document for the editTemplate. 


Regards, 
Prasanna Kumar N.S.V 


Loader.
Live Chat Icon For mobile
Up arrow icon