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

[Solved] GridState == null on WCF operation call

1 Answer 34 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
John
Top achievements
Rank 1
John asked on 25 May 2010, 07:55 AM
I am using MvcTurbine/Ninject/db4o/Telerik MVC 2010.1.309 in a simple web site prototype.
I am now stuck debugging a WCF service, the 'Select' operation is being passed null for the GridState.
All the Dependency Injection works, the model correctly returns GetAll() in nUnit tests.
What would cause a null to be passed to GridState?
What am I missing?

thanks in advance...

WCF interface:

namespace Necropolis.Habitat.Services 
{ 
   using System.ServiceModel; 
 
   using Telerik.Web.Mvc; 
 
   [ServiceContract] 
   public interface IISO 
   { 
      [OperationContract] 
      GridModel Select(GridState _state); 
 
   } 
} 

WCF service, markup included:
namespace Necropolis.Habitat.Services 
{ 
   using System.Linq; 
   using System.ServiceModel; 
   using System.ServiceModel.Activation; 
 
   using Ninject; 
   using Telerik.Web.Mvc; 
   using Telerik.Web.Mvc.Extensions; 
 
   /*
    <%@ ServiceHost Language="C#" 
                   Debug="true" 
                   Service="Necropolis.Habitat.Services.ISO" 
                   CodeBehind="ISO.svc.cs" 
                   Factory="Necropolis.Habitat.Infrastructure.DIServiceHostFactory" %> 
    */ 
 
   [ServiceBehavior(IncludeExceptionDetailInFaults = true)] 
   [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] 
   public class ISO : IISO 
   { 
      private Necropolis.ISO.Model.Contracts.Models.IISO_639_3_LanguageCode model_; 
 
      [Inject] 
      public ISO(Necropolis.ISO.Model.Contracts.Models.IISO_639_3_LanguageCode _model) 
      { 
         model_ = _model; 
      } 
 
      public GridModel Select(GridState _state) 
      { 
    // PROBLEM: 
    // 
    // _state == null 
 
         return (model_.GetAll().AsQueryable().ToGridModel(_state)); 
      } 
   } 
} 

This is the view:

<%@ Page Language="C#"  
            MasterPageFile="~/Views/Shared/Site.Master"  
            Inherits="System.Web.Mvc.ViewPage<IEnumerable<Necropolis.ISO.Model.Contracts.IISO_639_3_LanguageCode.View>>" %> 
 
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> 
    Home Page 
</asp:Content> 
 
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> 
<%  
    GridPagerStyles pagerStyles = GridPagerStyles.NextPreviousAndNumeric 
                                    | GridPagerStyles.PageInput 
                                    | GridPagerStyles.NextPrevious 
                                    | GridPagerStyles.Numeric; 
 
    Html.Telerik().Grid<Necropolis.ISO.Model.Contracts.IISO_639_3_LanguageCode.View>(Model) 
        .Name("Grid") 
        .DataKeys(keys => 
        { 
            keys.Add(c => c.GUID); 
        }) 
        .Columns(columns => 
        { 
            columns.Bound(o => o.Code).Width(80); 
            columns.Bound(o => o.RefName); 
        }) 
        .DataBinding(dataBinding => dataBinding 
            .WebService() 
                .Select("~/Services/ISO.svc/Select") 
        ) 
        .Groupable() 
        .Sortable() 
        .Pageable(paging => paging.Style(pagerStyles).PageSize(30)) 
        .Filterable() 
        .Scrollable() 
        .Footer(true) 
        .Render() 
        ; 
%> 
</asp:Content> 




1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 25 May 2010, 08:06 AM
Hello John,

The name of the web service method must be "state" not "_state". You can refer to our online example for more info.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or