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

[Solved] Master / Detail Grid and ClientTemplate issue

2 Answers 88 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.
Ashok
Top achievements
Rank 1
Ashok asked on 06 Apr 2011, 05:46 AM
Hi !!

I followed the example of Master / Detail sample and implemented it. From some other form post of telerik I found that in some cases I might have to use Bound Column with ".Template" and ".ClientTemplate".

I have spended 3-4 hours but having hard time implementing ".Template" and ".ClientTemplate". I am able to do it partially.

Can someone help.
columns.Bound(o => o.Id)
  
                   .Template(@<a href="#" onclick="return ConfirmReplace('@String.Format(LocalizedText.ReplaceMessage, @Model.Name, @item.FullName, "XYZ")', @item.Id, @item.CatId);"
                id="btnReplace" style="@string.Format("visibility: {0}", @item.CanShowReplace ? "visible" : "hidden")">@LocalizedText.ReplaceLinkText</a>)
  
.ClientTemplate("<a href=\"#\" id=\"btnReplace\" onclick=\"return ConfirmReplace(" + "'" + String.Format(LocalizedText.ReplaceMessage, "<#= Model.Name #>", "<#= item.FullName #>", "XYZ") + "'" + ");\" style=\"@string.Format(\"visibility: {0}\"," + "<#= item.CanShowReplace #>" + "? \"visible\" : \"hidden\")\">" + LocalizedText.ReplaceLinkText + "</a>")
    .Visible(@Model.CanShowReject)
                   .Title(string.Empty);

As you can see, I am not able to get item mark in bold in Client Template. Also, none of <#= #> item is showing up in message.

Why it is so difficult to make/use client template. Is there a simple way?

2 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 06 Apr 2011, 10:01 AM
Hi Tejas,

When using a client template you should reference the fields directly by name instead prefixing it with the dataItem's instance. For example:

<#= FullName #>
//instead of
<#= item.FullName #>


Regards,
Rosen
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
0
Ashok
Top achievements
Rank 1
answered on 06 Apr 2011, 02:48 PM
Hi Rosen!

You are awesome. Just resolved my issue in 5 min.
Tags
Grid
Asked by
Ashok
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Ashok
Top achievements
Rank 1
Share this question
or