Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I wants to enable/disable custom command in kendo-ui grid based on some other column. How do i achieve that? Below is sample code
@(Html.Kendo().Grid<Model>()
.Name("Grid")
.Columns(columns =>
   {
columns.Bound(a => a.Name).Width(90);
columns.Bound(a => a.Flag).Width(170);
columns.Command(commands => commands.Custom("ABC").Text("ABC").Click("ABC")).Title ("ABC").Width(130);
...
}


I want to enable/disable ABC command button based on flag value. Please help me
Posted
Updated 1-Nov-13 10:21am
v2

1 solution

I solved the problem. Below is the sample code.
    columns.Bound(a => a.Flag).ClientTemplate(
    "# if(Flag == 'Value1') { #" + "<input type="button">
    class='info k-button k-button-    icontext' onclick='clickhere(#=parameter1#)'
    value='ClickHere' />" +
    "# } else { #" +
    "NormalText" +
    "# } #").Width(100).Title("ConditionalButton");
    //JavaScript
    <script type="text/javascript">
    function clickhere(parameter1) {                                    
    window.location.href = '@Url.Action("Event", "Home")' + 
    '?parameter1=' +    parameter1;                    
    }
    </script>
</input>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900