Hello,
I am trying to evaluate the client-side databinding using WCF and am having a hard time getting the desired results. It appears that I have everything working correctly, and in Firebug I can see that the data is being returned from my WCF method, but it's not showing up in the grid. Also, it is returning the correct number of rows(it is showing the correct paging information and total row count) but is ignoring the pagesize property. Here are some snippets:
Here is the service:
Here is my web.config
Thanks!!
I am trying to evaluate the client-side databinding using WCF and am having a hard time getting the desired results. It appears that I have everything working correctly, and in Firebug I can see that the data is being returned from my WCF method, but it's not showing up in the grid. Also, it is returning the correct number of rows(it is showing the correct paging information and total row count) but is ignoring the pagesize property. Here are some snippets:
<telerik:RadGrid |
ID="rgTasks" |
runat="server" |
AllowPaging="true" |
ShowHeader="true" |
ShowStatusBar="true" |
AutoGenerateColumns="false" |
Skin="Vista" |
PageSize="15" |
AllowSorting="true"> |
<MasterTableView |
DataKeyNames="taskid" |
AlternatingItemStyle-BackColor="AliceBlue" |
CommandItemDisplay="Top" |
NoMasterRecordsText="No tasks found." |
ClientDataKeyNames="taskid"> |
<CommandItemSettings |
ShowExportToWordButton="true" |
ShowExportToExcelButton="true" |
ShowExportToCsvButton="true" |
ShowExportToPdfButton="true"/> |
<Columns> |
<telerik:GridBoundColumn |
DataField="taskid" |
HeaderText="Task ID" |
DataType="System.Int32"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn |
DataField="title" |
HeaderText="Title" |
DataType="System.String"> |
</telerik:GridBoundColumn> |
<%--<telerik:GridTemplateColumn |
DataField="description" |
SortExpression="description" |
HeaderText="Description"> |
<ItemTemplate> |
<dp:Label |
runat="server" |
ID="lblDescription" |
Text='<%# FormatTextForGridDisplay(Eval("description").ToString()) %>' |
ToolTip='<%# Eval("description") %>'> |
</dp:Label> |
</ItemTemplate> |
</telerik:GridTemplateColumn>--%> |
<telerik:GridBoundColumn |
DataField="assignedto" |
HeaderText="Assigned To" |
DataType="System.String"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn |
DataField="status" |
HeaderText="Status" |
DataType="System.String"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn |
DataField="priority" |
HeaderText="Priority" |
DataType="System.String"> |
</telerik:GridBoundColumn> |
<%--<telerik:GridTemplateColumn |
DataField="account" |
SortExpression="Account" |
HeaderText="account"> |
<ItemTemplate> |
<dp:Label |
runat="server" |
ID="lblAccount" |
Text='<%# Eval("description") %>'> |
</dp:Label> |
</ItemTemplate> |
</telerik:GridTemplateColumn>--%> |
<telerik:GridBoundColumn |
DataField="startdate" |
HeaderText="Start Date" |
DataType="System.String"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn |
DataField="duedate" |
HeaderText="Due Date" |
DataType="System.String"> |
</telerik:GridBoundColumn> |
</Columns> |
<PagerStyle Mode="NextPrevAndNumeric" /> |
</MasterTableView> |
<ClientSettings> |
<DataBinding |
SelectMethod="GetTasksForList" |
SelectCountMethod="GetTasksForListCount" |
Location="~/Services/Service.svc" |
StartRowIndexParameterName="startIndex" |
MaximumRowsParameterName="maxRowCount"> |
</DataBinding> |
</ClientSettings> |
</telerik:RadGrid> |
Here is the service:
[OperationContract] |
public TList<Tasks> GetTasksForList(int startIndex, int maxRowCount) |
{ |
TasksService ts = new TasksService(); |
TList<Tasks> tlist = ts.GetAll(); |
return tlist; |
} |
[OperationContract] |
public int GetTasksForListCount() |
{ |
TasksService ts = new TasksService(); |
return ts.GetAll().Count; |
} |
Here is my web.config
<system.serviceModel> |
<behaviors> |
<endpointBehaviors> |
<behavior name="ServiceAspNetAjaxBehavior"> |
<enableWebScript/> |
</behavior> |
</endpointBehaviors> |
<serviceBehaviors> |
<behavior name="metadataAndDebug"> |
<serviceMetadata httpGetEnabled="true" httpGetUrl="" /> |
<serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" /> |
</behavior> |
</serviceBehaviors> |
</behaviors> |
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/> |
<services> |
<service name="Service"> |
<endpoint address="" behaviorConfiguration="ServiceAspNetAjaxBehavior" binding="webHttpBinding" contract="Service"/> |
<endpoint address="mex" binding="mexHttpBinding" contract="Service" /> |
</service> |
</services> |
</system.serviceModel> |
Thanks!!