We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Sample for Databinding to a webservice

I think my asmx service is not setup correctly.
I have followed the user guide for binding to a webservice, but I get this error when accessing my webservice method -
Cannot serialize member Syncfusion.Mvc.Grid.GridWebService.Data of type System.Collections.IEnumerable because it is an interface.
Here is my Webmethod -

        public virtual GridWebService Index(WebServiceParams webParams)
            IEnumerable<License> licenseList = GetItems().ToList();
            return licenseList.GridWebServiceAction<License>(webParams);


6 Replies

SK Sarath Kumar P Syncfusion Team November 20, 2013 01:01 PM UTC

Hi Jeremy,


Thanks for using Syncfusion products.


We suspect that you have used the code IEnumerable<License> in your cshtml page. Please remove the specified code from your cshtml page to avoid your reported issue.


Please refer our online documentation link for further reference.




Please let us know if you have need further assistance.
























JB Jeremy Branham November 28, 2013 08:23 PM UTC

I am getting this exception when directly accessing the webmethod.
I can return a list of objects, but I cannot return a GridWebService object.

JB Jeremy Branham November 28, 2013 10:59 PM UTC

[NotSupportedException: Cannot serialize member Syncfusion.Mvc.Grid.GridWebService.Data of type System.Collections.IEnumerable because it is an interface.]

[InvalidOperationException: Cannot serialize member 'Syncfusion.Mvc.Grid.GridWebService.Data' of type 'System.Collections.IEnumerable', see inner exception for more details.]
   System.Xml.Serialization.StructModel.CheckSupportedMember(TypeDesc typeDesc, MemberInfo member, Type type) +5531266
   System.Xml.Serialization.StructModel.GetPropertyModel(PropertyInfo propertyInfo) +125
   System.Xml.Serialization.StructModel.GetFieldModel(MemberInfo memberInfo) +89
   System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter) +247
   System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter) +378
   System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) +1734

[InvalidOperationException: There was an error reflecting type 'Syncfusion.Mvc.Grid.GridWebService'.]

SK Sarath Kumar P Syncfusion Team December 4, 2013 10:21 AM UTC

Hi  Jeremy,


We regret for the inconvenience caused.


We suggest you to refer the below Web service asmx code snippets, cshtml page code snippets for your reference.




namespace Syncfusion.Mvc.Grid.Models


using System.ComponentModel;

using System.Linq;

using System.Web.Script.Services;

using System.Web.Services;

using MVCSampleBrowser.Models;

using Syncfusion.Mvc.Grid;

using System.Collections;

using System.Xml.Serialization;

using System.Runtime.Serialization;

using System.Collections.Generic;

using System.ServiceModel.Web;


[WebService(Namespace = "http://tempuri.org/")]

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]



public class OrdersAsmx : System.Web.Services.WebService



public GridWebService RenderOrders(WebServiceParams webParams)


IEnumerable data = new NorthwindDataContext().OrdersViews.Take(100).ToList();

return data.GridWebServiceAction<OrdersView>(webParams);












.Column(column =>


column.Add(p => p.OrderID).HeaderText("Order ID").TextAlign(TextAlignment.Right).Width(100);

column.Add(p => p.EmployeeID).HeaderText("Employee ID").TextAlign(TextAlignment.Right).Width(115);

column.Add(p => p.ShipAddress).HeaderText("Ship Address");

column.Add(p => p.ShipCity).HeaderText("Ship City").Width(150);

column.Add(p => p.ShipCountry).HeaderText("Ship Country").Width(170);


.EnablePaging().PageSettings(p => p.PageCount(5))






Please let us know if you need further assistance.







JB Jeremy Branham December 14, 2013 06:11 PM UTC

I'm using the most simple test, but I still get the same error.
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class LicenseService : System.Web.Services.WebService
        class test
            public int prop { get; set; }

        public GridWebService Get(WebServiceParams webParams)
            var testList = new List<test>();
            return testList.GridWebServiceAction<test>(webParams);

RD Rakesh D Syncfusion Team December 18, 2013 10:14 AM UTC

Hi Jeremy,


We are sorry for inconvenience caused. We are unable to reproduce the issue. We have prepared a simple working sample and the same can be downloaded from the following links.


Could you please try the below sample and get back to us whether you are able to reproduce the issue? If not, could you please give more information or by reproducing the issue in the above sample so that we could sort out the issue and provide you with solution. The information provided would be of great help in resolving the issue.


Sample :



Please let us know if you need any further assistance.



Rakesh D



Live Chat Icon For mobile
Up arrow icon