asp.net mvc - Telerik Grid action link with if condition in mvc -



asp.net mvc - Telerik Grid action link with if condition in mvc -

i'm using telerik grid.

i have 2 columns "status" , "view details"

in column bound of "view details" have check "status" column value.

if success have give link "view details" column.

on click of view details i'm calling javascript , continues.

i have written code below.

columns.bound(o => o.status).width(150).title("status").headerhtmlattributes(new { style = "text-align:center" }); columns.bound(o => o.viewdetails).width(50).title("view details").clienttemplate("# if (status == 'success') { #" + @html.actionlink("view details", "", "", new { onclick = "return onlinkclickviewdetails('<#= myparameter #>');" }, new { @title = "see" }).tohtmlstring() + "# } else {#"view details"#} #").htmlattributes(new { @style = "text-align:center" });

if "status" column's info success have show viewdetail link otherwise have show text.

i cant figure out wrong in code.please help me.

you can utilize inline if else, this:

.clienttemplate("<a href='" + ((y == 0/*put status here*/)?url.action("edit", "some"):"") + "/#= edit_id #'" + ">edit</a>");

asp.net-mvc razor telerik-grid

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -