This is a migrated thread and some comments may be shown as answers.

[Solved] Columns.Template not displaying

0 Answers 156 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Andrew
Top achievements
Rank 1
Andrew asked on 22 Mar 2012, 04:41 AM
i have been trying to use the columns.Template feature of telerik grid but for some reason it doesn't display anything it only shows the column but there's nothing in it. am i missing something?

@( Html.Telerik().Grid(Model)
       .Name("Orders")
            
       .Columns(columns =>
       {
          //Column which will display the ProductID property of the Product
          columns.Bound(o => o.ProductID);
 
          columns.Bound(o => o.ProductName).Title("Product");
 
          //Template column which shows an action link
          columns.Template(o =>
          {
              @Html.ActionLink("Edit", "Edit", new { id = o.ProductID };
          }).Title("Edit");
       })
        
)

UPDATE:

it seems that it works now but when i try using ajax data binding the columns.template will only show on the 1st load, if i try clicking the refresh button of the telerik grid all the columns.template will disappear. 

if i use it like this:
@( Html.Telerik().Grid(Model)
       .Name("Orders")
          .DataKeys(keys =>
           {
               keys.Add(c => c.ProductID);
           })
          .DataBinding(dataBinding => dataBinding.Ajax()
                            .Select("_SelectAjaxEditing", "Home"))
       .Columns(columns =>
       {
          //Column which will display the ProductID property of the Product
          columns.Bound(o => o.ProductID);
 
          columns.Bound(o => o.ProductName).Title("Product");
 
          //Template column which shows an action link
          columns.Template(o =>
          {
              @Html.ActionLink("Edit", "Edit", new { id = o.ProductID };
          }).Title("Edit");
       })
        
)
Tags
Grid
Asked by
Andrew
Top achievements
Rank 1
Share this question
or