asp.net mvc 3 - How to use different action in Command Column in Grid for Telerik MVC extension -


i using telerik mvc extension version 2012.1.419.340. had problem command column in grid. use example code on telerik website explain problem.

i have view like:

@model ienumerable<order> @(html.telerik().grid(model) .name("grid") .columns(columns => {     columns.bound(o => o.orderid).width(100);     columns.bound(o => o.shipaddress);     columns.command(commands => commands                 .custom("viewdetails")                 .text("view details")                 .dataroutevalues(route => route.add(o => o.orderid).routekey("orderid"))                 .ajax(true)                 .action("viewdetails", "grid"))             .htmlattributes(new { style = "text-align: center" })             .width(150); }) .clientevents(events => events.oncomplete("oncomplete")) .databinding(databinding => databinding.ajax().select("_customcommand", "grid")) .pageable() .sortable() .filterable() 

)

and order model like

public class order{   public int orderid {get;set;}    public string shipaddress {get ; set; }    public bool canedit {get; set;} } 

i command column use different action depending on canedit value. example, if canedit false, using action

columns.command(commands => commands                 .custom("viewdetails")                 .text("view details")                 .dataroutevalues(route => route.add(o => o.orderid).routekey("orderid"))                 .ajax(true)                 .action("viewdetails", "grid"))             .htmlattributes(new { style = "text-align: center" }) 

if canedit true, using action

columns.command(commands => commands                 .custom("editdetails")                 .text("edit details")                 .dataroutevalues(route => route.add(o => o.orderid).routekey("orderid"))                 .ajax(true)                 .action("editdetails", "grid"))             .htmlattributes(new { style = "text-align: center" }) 

can give me idea how implement it?

thanks

finally solved issue using template column in grid. found there no way change text command column on demand. thanks


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -