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

Grid Editing Template Dialog with RichTextBox

Hello in the club,

when I paste and edit items in Grid I use Dailog Template. I want RichTextEditor in the Template Dialog, but I can not figure out how to get its content.
All other elements work correctly.


Examples are View, PartialView and Controller.


Thanks for help.

Attachment: GridWithRTE_d1bfa336.zip

3 Replies

MS Madhu Sudhanan P Syncfusion Team December 3, 2018 07:02 AM UTC

Hi Patrik, 

We have checked your query and for  Dialog Edit template, the editors must have the name attribute and both the id and name attribute should has the value as the corresponding field name. But while using RichTextEditor, its editor element (‘textarea’)  id will be added with “-value” string  by RichTextEditor internally. This is the cause of the reported behavior. However you can achieve your requirement by reading the Editor’s value in the actionBegin event of Grid component. Please refer to the below code example, Documentation link and sample link. 

[index.cshtml] 
<div class="control-section"> 
    <ejs-grid id="Grid" dataSource="ViewBag.dataSource" actionBegin="actionBegin" actionComplete="actionComplete" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })" allowPaging="true"> 
        <e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Dialog" template='#dialogtemplate'></e-grid-editSettings> 
        <e-grid-pagesettings pageCount="5 "></e-grid-pagesettings> 
        <e-grid-columns> 
           .  . . 
        </e-grid-columns> 
    </ejs-grid> 
</div> 
 
<script id='dialogtemplate' type="text/x-template"> 
    <div id="dialogTemp"> 
    </div> 
</script> 
 
<script> 
    function actionBegin(args) { 
        if (args.requestType === 'save') { 
            args.data['ShipAddress'] = args.form.querySelector("#ShipAddress-value").value; 
        } 
    } 
 
</script> 

[editpatial.cshtml] 
 
<div> 
    .  .  . 
    <div class="form-row"> 
        <div class="form-group col-md-12"> 
            <div class="e-float-input e-control-wrapper"> 
                    <ejs-richtexteditor id="ShipAddress" value=@Model.ShipAddress ejs-for="ShipAddress" placeholder="Popis vozu"> 
                    </ejs-richtexteditor> 
            </div> 
        </div> 
    </div> 
</div> 
 
<ejs-scripts></ejs-scripts> 



Regards, 
Madhu Sudhanan P 



PV Patrik Volka December 3, 2018 08:17 AM UTC

Thanks for help


MS Madhu Sudhanan P Syncfusion Team December 3, 2018 08:48 AM UTC

Hi Patrik, 
Please get back to us if you require further assistance. 
Regards, 
Madhu 


Loader.
Live Chat Icon For mobile
Up arrow icon