Maintain default edit template while using custom view template

Hello,
I'm using the Grid control of ASP.NET MVC package.

For a specific column, I want to use a custom template, just to add an icon next to the value itself.

This is my template:
<script type="text/x-jsrender" id="colTelefono">
    <span>{{:Telefono}}</span>&nbsp;
    <a rel='nofollow' href="#" onclick="verificaTelefono({{:Id}}, this)">
        <i class="fa fa-info-circle"></i>
    </a>
</script>
This is my column:
col.Field(x => x.Telefono).Template("#colTelefono").Width(100).Add();
However, when I want to edit the row, the corrisponding cell of the offending column is not editable.
I want to avoid a custom edit template; instead I want to use the default template.
Is this possible? If not, what solutions are there?

Thank you

1 Reply

KM Kuralarasan Muthusamy Syncfusion Team March 26, 2018 01:25 PM UTC

Hi Omar, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and we suggest you to EditTemplate of the grid to achieve your requirement. We have prepared the sample with EditTemplate. 

Please refer the following code example: 
@(Html.EJ().Grid<EmployeeView>("Edittemplate") 
             
                ....... 
           
            .Columns(col => 
            { 
 
                  .....                 
 
                col.Field("LastName").Template("#colTelefono").EditTemplate(a => { a.Create("create").Read("read").Write("write"); }).HeaderText("Last Name").Width(100).Add(); 
 
                  ..... 
 
            }) 
 
) 
<script type="text/javascript"> 
    function create() { 
        return $("<input>"); 
    } 
 
    function write(args) { 
 
          ... 
    } 
 
    function read(args) { 
 
          ... 
    } 
    $("#Edittemplate").keyup(function (e) { 
 
          ... 
        } 
    }); 
</script> 


Please refer the following link for sample: 


Please refer the following link to know about EditTemplete


If you need further assistance please get back to us, 

Regards, 
Kuralarasan M. 


Loader.
Up arrow icon