Click here to Skip to main content
15,887,264 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to write some codes that can show details of my item by using the Action method.


C#
@(Html.Kendo().Grid<Jahan.Blog.Model.Article>()
          .Name("ArticleAdmin").Navigatable()
          .Resizable(c => c.Columns(true))
          .HtmlAttributes(new { @class = "cursorLink", @style = "width: 1000px;height:auto;overflow: scroll;" })
          .Columns(columns =>
          {
              columns.Bound(p => p.UserId).Width(100);
              columns.Bound(p => p.Title).Width(200);
              columns.Bound(p => p.LikeCounter).Width(100);
              columns.Bound(p => p.RateCounter).Width(100);
              columns.Bound(p => p.IsActive).Encoded(false).ClientTemplate("<img src='/Content/#= IsActive ? 'tick.png' : 'cross.png' #''>").Width(80);
              columns.Bound(p => p.IsActiveNewComment).Encoded(false).ClientTemplate("#= showActivationStatusIcon(IsActiveNewComment) #").Width(170);
              columns.Bound(p => p.CreatedDate).Width(160).Format("{0:G}");
              columns.Bound(p => p.ModifiedDate).Width(160).Format("{0:G}");
              columns.Command(command => command.Destroy()).Width(170);
              columns.Command(command => command.Custom("ViewDetails").Click("showDetails")).Width(60);
          })
          .ToolBar(toolbar =>
          {
              toolbar.Create();
              toolbar.Save();
          })
          .Editable(editable => editable.Mode(GridEditMode.InCell))
          .Pageable()
          .Navigatable()
          .Sortable()
          .Scrollable()
          .DataSource(dataSource => dataSource
              .Ajax()
              .Batch(true)
              .PageSize(20)
              .ServerOperation(false)
              .Events(events => events.Error("error_handler"))
              .Model(model => model.Id(p => p.Id))
              .Create("Editing_Create", "ArticleAdmin")
              .Read("Editing_Read", "ArticleAdmin")
              .Update("Editing_Update", "ArticleAdmin")
              .Destroy("Editing_Destroy", "ArticleAdmin")
          ))


What I have tried:

For this goal, Ive used custom command, instead of using ClientTemplate. How to write javascript action?

function showDetails() {
// what code should be written here?
// var action = '@Url.Action("Details", "ArticleAdmin")';
}
Posted
Updated 1-Dec-16 20:21pm
v4
Comments
Karthik_Mahalingam 2-Dec-16 23:04pm    
you mean the url?

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