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

RadGrid - Cannot populate with data from WCF

1 Answer 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 20 Apr 2009, 08:08 AM
.ASCX:
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
 
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"
</telerik:RadScriptManager> 
 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="RadGrid1"
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManager> 
 
<telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None"  
    AllowPaging="True"
    <MasterTableView> 
        <Columns> 
        <telerik:GridBoundColumn DataField="Price" HeaderText="Price" /> 
        </Columns> 
    </MasterTableView> 
    <ClientSettings> 
        <DataBinding Location="http://localhost:3910/Ajax/WCFPropertyService.svc" 
        SelectMethod="GetPropertyInformationForGrid"  
        SelectCountMethod="GetPropertyCount" 
        StartRowIndexParameterName="startIndex"                     
        MaximumRowsParameterName="rowCount">       
        </DataBinding> 
        <ClientEvents OnCommand="RadGrid1_Command"/> 
    </ClientSettings> 
</telerik:RadGrid> 

WCF Interface:
        [OperationContract(Name = "GetPropertyInformationForGrid")] 
        [WebInvoke(Method = "GET"
                   BodyStyle = WebMessageBodyStyle.Wrapped,
                   ResponseFormat = WebMessageFormat.Json)] 
        List<vc.PropertyInformation> GetPropertyInformationForGrid(int startIndex, int rowCount);
 
        [OperationContract(Name = "GetPropertyCount")] 
        [WebInvoke(Method = "GET"
                   BodyStyle = WebMessageBodyStyle.Wrapped,
                   ResponseFormat = WebMessageFormat.Json)] 
        int GetPropertyCount(); 

Result calling GetPropertyCount() from browser:
{"GetPropertyCountResult":3} 

Result calling GetPropertyInformationForGrid() from browser:
 
{"GetPropertyInformationForGridResult":[{"BasementSize":0,"DateCreated":null,"ElapsedDays":null,"Gross":0,"LotSize":0,"Net":0,"Payout":0,"PostCodeIdentifier":null,"Price":1000,"PriceDevelopment":null,"PropertyType":0,"Rooms":0,"Size":0,"SqmPrice":0,"StreetBuildingIdentifier":null,"StreetName":null,"YearBuilt":0},{"BasementSize":0,"DateCreated":null,"ElapsedDays":null,"Gross":0,"LotSize":0,"Net":0,"Payout":0,"PostCodeIdentifier":null,"Price":1700,"PriceDevelopment":null,"PropertyType":0,"Rooms":0,"Size":0,"SqmPrice":0,"StreetBuildingIdentifier":null,"StreetName":null,"YearBuilt":0},{"BasementSize":0,"DateCreated":null,"ElapsedDays":null,"Gross":0,"LotSize":0,"Net":0,"Payout":0,"PostCodeIdentifier":null,"Price":900,"PriceDevelopment":null,"PropertyType":0,"Rooms":0,"Size":0,"SqmPrice":0,"StreetBuildingIdentifier":null,"StreetName":null,"YearBuilt":0}]} 

Nothing happens. No data in my grid. I hope this is enough information for somebody to point me in the right direction.


1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 23 Apr 2009, 09:13 AM
Hello Martin,

Can you please try applying the following attribute on your OperationContract's instead:
[WebInvoke(Method = "POST",  
BodyStyle = WebMessageBodyStyle.WrappedRequest,  
ResponseFormat = WebMessageFormat.Json)]  

This should help.

Sincerely yours,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Martin
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or