Ok.. after reading the documentation on binding ado.net data service every example seems reflect everything im doing but its still not working. Here is what i have
Service.svc code
| Public Shared Sub InitializeService(ByVal config As IDataServiceConfiguration) |
| config.SetEntitySetAccessRule("*", EntitySetRights.AllRead) |
| config.SetServiceOperationAccessRule("*", ServiceOperationRights.All) |
| End Sub |
| <WebGet()> _ |
| Public Function GetSessions() As IQueryable(Of Session) |
| Return (From Sessions In Me.CurrentDataSource.Session _ |
| Select Sessions) |
| End Function |
| <WebGet()> _ |
| Public Function GetCount(ByVal where As String) As Integer |
| Return If([String].IsNullOrEmpty(where), CurrentDataSource.Session.Count(), CurrentDataSource.Session.Where(where).Count()) |
| End Function |
This service works fine..
Here is my web page code
| <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> |
| <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> |
| <%@ Register assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" namespace="System.Web.UI.WebControls" tagprefix="asp" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head runat="server"> |
| <title></title> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <div> |
| <telerik:RadScriptManager ID="RadScriptManager1" Runat="server"> |
| </telerik:RadScriptManager> |
| </div> |
| <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"> |
| <telerik:RadGrid ID="RadGrid1" runat="server" |
| GridLines="None" AutoGenerateColumns="False"> |
| <MasterTableView> |
| </MasterTableView> |
| <ClientSettings> |
| <DataBinding Location="http://localhost:1687/BCSS.svc/" |
| SelectMethod="GetSessions" |
| SelectCountMethod="GetCount" > |
| <DataService TableName="Session" /> |
| </DataBinding> |
| </ClientSettings> |
| </telerik:RadGrid> |
| </telerik:RadAjaxPanel> |
| </form> |
| </body> |
| </html> |
When i run the page it gives me the following error "Cannot find any bindable properties in an item from the datasource "
All of the examples mention i have to a Location,Selectmethod,Selectcountmethod when calling a data service. What am i miss here?
However if i comment out the clientside setting and put in a serverside code on the page load like this it works
| Dim WS As New BCSSEntities(New Uri("http://localhost:1687/BCSS.svc/", UriKind.Absolute)) |
| Dim query = From Session In WS.Session _ |
| Select Session |
| Me.RadGrid1.DataSource = query |
| Me.RadGrid1.DataBind() |
Please advise!!