Вопрос

I am currently using Telerik's RadGrid Binder in an ASP.NET user control to display content on a page. Most of the data-binding works correctly:

<sf:DataMemberInfo runat="server" Name="Title" HeaderText='Title'>
    <strong>{{ Title }}</strong>
</sf:DataMemberInfo>

However, if I try to bind within an HTML tag, no data-binding takes place:

<sf:DataMemberInfo runat="server" Name="ImageUrl" HeaderText='Image'>
    <span><img src='{{ ImageUrl }}' /></span>
</sf:DataMemberInfo>

In the above instance, {{ ImageUrl }} is literally rendered. Is there some other technique available so that {{ ImageUrl }} will data-bind properly?

Это было полезно?

Решение

Currently, the workaround I have done was to hook into the binder's DataBound event in JavaScript. Within that event, I access a hidden field where I dump the properly-bound {{ImageUrl}} property, and assign the <img> tag's src attribute to it.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top