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

[Solved] WCF Data Binding

1 Answer 108 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ranjith
Top achievements
Rank 1
Ranjith asked on 13 Feb 2012, 12:35 PM
Hi Team,

Can you pls tell me whether your MVC Grid supports WCF databinding, if so can you pls send me a simple sample which illustrates the behaviour?

Awaiting for your reply.

Regards,
Ranjithkumar

1 Answer, 1 is accepted

Sort by
0
Dadv
Top achievements
Rank 1
answered on 15 Feb 2012, 02:25 PM
Hi,

I think MVC pattern would be better if you use the model/controller approch.

If you bind directly to a WCF service, you may use it own Model, an assum that the controller is the service him self.

But you can get this working by using REST approach and the webHttpBinding :

The WCF interface :
[ServiceContract]
public interface IOrderService
{
 
        [WebGet(UriTemplate = "Service/GetOrders")]
        [OperationContract]
        IEnumarable<Order> GetOrders();
}


in the grid :

<%= Html.Telerik().Grid<Order>()       
.Name("wcfGrid")       
.DataBinding(dataBinding => dataBinding.WebService().Select("http://localhost/Service/GetOrders"))       
.Columns(columns =>       
{          
columns.Bound(o => o.OrderID).Width(81);          
columns.Bound(o => o.Customer.ContactName).Width(200);          
columns.Bound(o => o.ShipAddress);          
columns.Bound(o => o.OrderDate).Format("{0:MM/dd/yyyy}").Width(100);       
})       
.Sortable()      
.Pageable()       
.Filterable()       
.Scrollable()
%>

I didn't try it but i think it will work fine.

Regards,
Tags
General Discussions
Asked by
Ranjith
Top achievements
Rank 1
Answers by
Dadv
Top achievements
Rank 1
Share this question
or