我似乎可以使用Telerik控件使客户端绑定工作(2天后)。 AM我没有提供正确的假值/配对数据?没有正确找到控件ID?
从客户端将数据正确绑定到Telerik RadListView需要做些什么?
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Admin.WebForm1" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">
<title></title>
<script type="text/javascript">
//
</script>
<script src="scripts/jquery-2.1.1.min.js"></script> </head> <body>
<form id="form1" runat="server">
<div>
<telerik:RadScriptManager ID="rsm1" runat="server"></telerik:RadScriptManager>
<telerik:RadListView
ItemPlaceholderID="itemPlaceHolder"
ID="listviewHere" runat="server" ClientIDMode="Static">
<ClientSettings>
<DataBinding>
<LayoutTemplate>
<ul id="itemPlaceHolder">
</ul>
</LayoutTemplate>
<AlternatingItemTemplate>
</AlternatingItemTemplate>
<EmptyDataTemplate>
nothing
</EmptyDataTemplate>
<ItemTemplate>
<li>#= id # ----sdfdsfsdsdf</li>
</ItemTemplate>
</DataBinding>
</ClientSettings>
</telerik:RadListView>
</div>
</form>
<script type="text/javascript">
//$("#grid1").hide();
//$("#listviewHere").show();
$(document).ready(function () {
var data = [{ id: 1, name: "name1", value: 12.4 }, { id: 2, name: "name2", value: 12.4 }];
var listView = $find("#listviewHere");
//var listView = listviewHere().get_masterTableView();
//listView.get_masterTableView();
listView.set_dataSource(data);
listView.dataBind();
});
</script>
</body> </html>
答案 0 :(得分:1)
您没有正确找到listview客户端对象 - 您应该使用:
var listView = $find('<%= listviewHere.ClientID %>');
检查其网站上的客户端数据绑定演示:
http://demos.telerik.com/aspnet-ajax/listview/examples/client/appendingdata/defaultcs.aspx