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

[Solved] ClientTemplate rendering on initial load

1 Answer 107 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.
John
Top achievements
Rank 2
John asked on 26 Apr 2010, 12:59 PM

I am very new to the Telerik MVC controls and have been implementing the Grid on a View, mostly with success.  I am having one small problem in the I can't seem to get ClientTemplate to render correctly on initial load, basically it come up with the ID value.  When I refresh it display "View".  I am not sure if i am missing something here or maybe because using VB in VS2010.
Ideally I would like to use the line above or one like in the Toolbar but I beleive from searching this will be in a future realease. 

I hope this is clear.

John

 
    <%  Html.Telerik().Grid(Model()) _  
            .Name("Grid") _  
            .ToolBar(Sub(commands)  
                         commands.Custom() _  
                         .Action("Create", "User") _  
                         .Text("Add New")  
                     End Sub) _  
            .DataKeys(Function(keys) keys.Add(Function(c) c.UserID)) _  
            .Columns( _  
            Sub(columns)  
                'columns.Template(Function(o) Html.ActionLink("Edit", "Edit", New With {.id = o.UserID}))  
                columns.Bound(Function(o) o.UserID()).ClientTemplate("<a href='/User/Details/<#= UserID #>'>View</a>").Filterable(False).Sortable(False).Title("Action")  
                columns.Bound(Function(o) o.UserID()).Width(40)  
                columns.Bound(Function(o) o.Organisation()).Width(200)  
                columns.Bound(Function(o) o.Security())  
                columns.Bound(Function(o) o.LastName())  
                columns.Bound(Function(o) o.FirstName())  
                columns.Bound(Function(o) o.OtherNames())  
                columns.Bound(Function(o) o.Status())  
                columns.Bound(Function(o) o.StartDate()).Format("{0:dd/MM/yyyy}").Width(120)  
                columns.Bound(Function(o) o.EndDate()).Format("{0:dd/MM/yyyy}").Width(120)  
                columns.Bound(Function(o) o.HTMLEmail())  
            End Sub) _  
            .DataBinding(Sub(dataBinding)  
                             dataBinding.Server().Select("Index", "User")  
                             dataBinding.Ajax().Select("_Index", "User")  
                         End Sub) _  
            .Scrollable(Function(scrolling) scrolling.Enabled(True)) _  
            .Sortable(Function(sorting) sorting.Enabled(True)) _  
            .Pageable(Function(paging) paging.Enabled(True)) _  
            .Filterable(Function(filtering) filtering.Enabled(True)) _  
            .Groupable(Function(grouping) grouping.Enabled(True)) _  
            .Footer(True) _  
            .Render()%>  
 


 

1 Answer, 1 is accepted

Sort by
0
John
Top achievements
Rank 2
answered on 26 Apr 2010, 01:42 PM
I beleive I found a solution.  I replace the line below (commented) with the line above it.

                columns.Bound(Function(o) o.UserID).Format(Html.ActionLink("Edit", "Edit", New With {.id = "{0}"}).ToHtmlString).Encoded(False).Title("Action").Filterable(False).Sortable(False)  
                'columns.Bound(Function(o) o.UserID()).ClientTemplate("<a href='/User/Details/<#= UserID #>'>View</a>").Filterable(False).Sortable(False).Title("Action")  
 

If there is a way of substituting the text with an image that would be great.

Thanks for a great control.
Tags
Grid
Asked by
John
Top achievements
Rank 2
Answers by
John
Top achievements
Rank 2
Share this question
or