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

grid JSON Binding Client Template Not displayed

3 Answers 53 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.
Jeremy
Top achievements
Rank 1
Jeremy asked on 16 Dec 2010, 12:40 PM
Hi Iam binding the Grid using JSON, but the client template ended up with showing nothing instead the bound column displayed.

<%= Html.Telerik().Grid<Sample.Models.AccountItem>()
            .Name("Grid")
            .Columns(columns =>
            {
                columns.Bound(c => c.city);
                columns.Bound(c => c.zip).Width(200);
                columns.Bound(c => c.lname)
                    .ClientTemplate("<div><ul>" +
                                        "<li class='Details'><label>Name:</label><#=lname #></li>" +
                                         "<li class='Details'><label>City:</label><#=city #></li>" +
                                          "<li class='Details'><label>ZIP:</label><#=zip #></li>" +                                         
                                    "</ul></div>")
                    .Title("Details");
                //omitted for brevity
            })
            .ClientEvents(events => events
                .OnDataBinding("onDataBinding")
            )
            .Pageable(settings => settings.PageSize(1))
                %>



3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 16 Dec 2010, 12:48 PM
Hello Jeremy ,

 We have just replied to your support ticket which you posted regarding the same problem.

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
0
Scott
Top achievements
Rank 1
answered on 09 Mar 2011, 05:35 PM
Can you share the results of this support ticket on this thread to help others with this problem?

Thanks,

Scott
0
Hiren
Top achievements
Rank 1
answered on 24 Mar 2011, 01:00 PM
How to bind JSON LIST to telerik grid control using ASP.NET MVC Razor sample.

---------
List<Dictionary<string, string>> myList = new List<Dictionary<string, string>>();
myList = Json.Decode<List<Dictionary<string, string>>>(view);
---------
<script type="text/javascript">
function BindGridView() {
$.ajax({
type: "POST",
url: "/Test/GetCustomersJSON",
data: "{}",
contentType: "application/json",
dataType: "json",
success: function (data) {

var obj = $.parseJSON(data);
$("#divTest").append("<Ul>");
jQuery.each(obj, function () {
$("#divTest").append("<li>" + this.Id + ", " + this.CustomerName + ", " + this.Address + "</li>");
});
$("#divTest").append("</Ul>");
}
});
}
</script>
----------------

<body onload="BindGridView();">
<div id="divAllergies">
</div>
</body>
-----------------

the above code works fine and its displaying the list in div but i want to bind the same list to TelerikGrid?

--Giri
http://giribabu.wordpress.com
Tags
Grid
Asked by
Jeremy
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Scott
Top achievements
Rank 1
Hiren
Top achievements
Rank 1
Share this question
or