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.
Unfortunately, activation email could not send to your email. Please try again.

Grid Template Column

Thread ID:

Created:

Updated:

Platform:

Replies:

132057 Aug 10,2017 07:23 AM Aug 11,2017 01:52 AM ASP.NET MVC 1
loading
Tags: Grid
Paul Smith
Asked On August 10, 2017 07:23 AM

I want to remove the template button based on value in row
I am using template refresh event.
it does not remove the button
what do I need to add to remove the template from the cell?
thanks

 col.HeaderText("Delete").Template("<input type=\"button\" value=\"Delete\"  data-toggle=\"tooltip\" title=\"Delete\" onclick=\"WorkOrderDatePartial_WorkOrderDateDelete_click(this)\" />").Width(75).Add();


 function dgWorkOrderDate_TempleteRefresh(args) {
        //alert('refresh');

       // var val = args.data["Id"];
        var cell = $(args.cell);

        //render the button control
        // if (val ==null || val==0 || val<1) {
        cell.find(".template").css("visibility", "hidden");
        cell.find(".template").remove();


    }

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On August 11, 2017 01:52 AM

Hi Paul,  
 
Thanks for contacting Syncfusion Support.  
 
We can use the jsRender IF/Else cases and prevent the button’s visibility within the template. Refer to the following code example.  
 
@(Html.EJ().Grid<object>("Grid") 
        .Datasource((IEnumerable<object>)ViewBag.data) 
        .Columns(col => 
        { 
            col.Template("#columntemplate").Add(); 
               . . . 
        }) 
) 
 
    <script type="text/x-jsrender" id="columnTemplate"> 
        {{if EmployeeID % 2 == 0}} 
                      <input type="button" value="{{:EmployeeID}}"> 
        {{else}} 
                     <span>{{:EmployeeID}}</span> 
        {{/if}} 
    </script> 
 
 
Regards, 
Seeni Sakthi Kumar S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;