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

How to insert Image link in column.

0 Answers 51 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.
uandme77
Top achievements
Rank 1
uandme77 asked on 28 Mar 2011, 06:09 PM
I am working on a MVC application and using telerik mvc grid. I need to show clickable Speaker Image icon in column against a voice link, I achived this by using server side and client side template, but due to client side template when i sort/refresh the grid Speaker Image link does'nt call the javascript function, nothing happens.
<% Html.Telerik().Grid(Model.GetVariables)
                        .Name("VariableGrid")
                        .DataKeys(dataKeys => dataKeys.Add(m => m.variableId))
                        .Columns(columns =>
                            {
                                columns.Bound(m => m.variableDescription).Title("Description");
                                columns.Bound(m => m.variableVoiceLink).Title("Voice Link")
                                    //Template to show Listen (Speaker) icon
                                    .Template(m =>
                                            {%>
                                                <a href="#?w=300" rel="popup_Upload" class="poplightUpload" lang="<%=m.variableId%>" >
                                                    <img title="Upload audio" style="border:0; float:right;"  src="<%:Url.Content("~/Content/TMG/Images/Upload.png") %>" />
                                                </a>
                                                <% if (!string.IsNullOrEmpty(m.variableVoiceLink))
                                                   { %>
 
                                                        <sup><label style="padding-right:4px; font-size:small;" ><%=m.variableVoiceLink%> </label>
                                                        <a style=" padding:6px" href="#?w=300" rel="popup_name" class="poplight" lang="<%=m.variableVoiceLink%>" >
                                                            <img title="Play Voice" style="border:0; float:right; padding-right:3px;"  src="<%:Url.Content("~/Content/TMG/Images/speaker.png") %>" />
                                                       </a>
                                                       </sup>
 
                                                   <%}
                                                   else
                                                   {%> <label><%=m.variableVoiceLink%> </label> <%} %>
 
                                            <%})
                                     
 
.ClientTemplate("<a href='#?w=300' rel='popup_Upload' class='poplightUpload' lang = '<#= variableId #>' >" +
                                                        "<img title='Upload audio' style='border:0; float:right;'  src='../Content/TMG/Images/Upload.png'/>" +
                                                      "</a>" +
                                                       "<# if (variableVoiceLink != null)" +
                                                        "{ #> <sup><label style='padding-right:4px; font-size:small;'> <#= variableVoiceLink #> </label>" +
                                                              "<a href='#?w=300' rel='popup_name' class='poplight' lang = '<#= variableVoiceLink #>' >" +
                                                                "<img title='Play Voice' style='border:0; float:right;'  src='../Content/TMG/Images/speaker.png'/>" +
                                                              "</a></sup>" +
                                                        "<# } #>");
 
Tags
Grid
Asked by
uandme77
Top achievements
Rank 1
Share this question
or