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

[Solved] Template and ClientTemplate

2 Answers 160 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.
Kevin
Top achievements
Rank 1
Kevin asked on 21 Sep 2010, 06:06 PM
I cannot get an image to display in a column using either client-side or server-side templates.

Here is the server-side template I've used.  It results in an HTTP 500 error.

<%

= Html.Telerik().Grid(Model.notes)

 

.Name(

"Grid")

 

.Columns(columns =>

{

columns.Template(n =>

{

%>

 

<img alt="" src="<%= Url.Content("~/Content/images/") + AlertImage %>" />

 

<%

});

columns.Bound(n => n.Alert).Width(45);

columns.Bound(n => n.NoteTime).Format(

"{0:MM/dd/yyyy}").Width(100);

 

columns.Bound(n => n.Name).Width(100);

columns.Bound(n => n.NoteText).Width(400);

columns.Bound(n => n.Private).Width(45);

})

.Sortable()

.Render();

%>


I've attempted the same with client-side templates, specifying the type in the Telerik.Grid<> rather than performing the binding server-side and using .ClientTemplate.  The client-side template simply displays the filename of the image (held in AlertImage) rather than using the <img> tag and interpreting the HTML.

Any help is appreciated.

2 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 1
answered on 21 Sep 2010, 07:28 PM
I should point out that the above code snippet comes from a partial view that is loaded via Ajax.  Perhaps my problem is that the supporting JavaScript files are not getting loaded.  I also get a JScript runtime error (unsupported method 'insertBefore', which is why I'm thinking this way.  The JavaScript files are loaded in the parent view by means of a ScriptRegistrar() in the master page.
0
Atanas Korchev
Telerik team
answered on 22 Sep 2010, 07:07 AM
Hi Kevin,

 We have two examples showing how to implement exactly the same thing:
Client Templates
Server Templates

Your code does not indicate what the problem may be. I suggest you attach a running sample which shows the JavaScript error.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Kevin
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or