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

Kendo Grid bind with WCF Data

3 Answers 209 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nishant
Top achievements
Rank 1
Nishant asked on 05 Mar 2013, 02:25 PM
Hi,

I am doing a POC for one of the project where I am required to show data in KendoUI Grid coming from WCF service. 

I've tried to create a sample but seems like no luck.

I looked around but couldn't figure out exact working sample. I've created a sample application. In Default.aspx page I am trying to get data from a WCF service i.e. HTML5Service.svc residing withing the same project. 

A simple call to service is done as shown below
../HTML5Service.svc/list
When I make a call using simple HTMl5.html page it gets called. But when I am trying to make a call through kendoGrid's datasource it's not getting called. 
<!DOCTYPE html>
 
<html>
<head>
    <title> Hello Kendo UI</title>
    <link href="Content/kendo/2012.3.1114/kendo.common.min.css" rel="stylesheet" />
    <link href="Content/kendo/2012.3.1114/kendo.default.min.css" rel="stylesheet" />
</head>
<body>
    
    <div id="employeesGrid"></div>
 
    <script src="Scripts/jquery-1.8.3.min.js"></script>
    <script src="Scripts/kendo/2012.3.1114/kendo.web.min.js"></script>
 
    <script>
        $(function () {
 
            $("#employeesGrid").kendoGrid({
                dataSource: new kendo.data.DataSource({
                    transport: {
                        read: "../HTML5Service.svc/list"
                    }
                })
            });
        });
    </script>
</body>
</html>


A quick help will be highly appreciated. Since it help us to use kendoUI or not as our most of the business is dependent on WCF service. 

Thanks!!

3 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 07 Mar 2013, 09:19 AM
Hi Nishant,

I have looked at the sample you have provided. It seems that the service is hit, however as its result is wrapped you should set a schema definition.  Also note that Grid can be bound only to an array of objects and cannot be bind to an array of string, which is the case with your example.

You can  find a runnable sample, which demonstrates Grid widget bound to a WCF service here.

Greetings,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Nishant
Top achievements
Rank 1
answered on 08 Mar 2013, 01:36 AM
Hi Rosen,

I tried to run the code but I got an exception in QueryableExtnesions.cs file under ToDataSourceResult<T> . Execption details are as follow:

System.Data.EntityException was unhandled by user code
  Message=The underlying provider failed on Open.
  Source=System.Data.Entity
  StackTrace:
       at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure)
       at System.Data.EntityClient.EntityConnection.Open()
       at System.Data.Objects.ObjectContext.EnsureConnection()
       at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
       at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
       at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
       at System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__3[TResult](IEnumerable`1 sequence)
       at System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
       at System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[S](Expression expression)
       at System.Linq.Queryable.Count[TSource](IQueryable`1 source)
       at QueryableExtensions.ToDataSourceResult[T](IQueryable`1 queryable, Int32 take, Int32 skip, IEnumerable`1 sort, Filter filter) in c:\Documents and Settings\nishantrana\My Documents\Downloads\KendoWCFGrid\App_Code\QueryableExtensions.cs:line 24
       at Products.Read(Int32 skip, Int32 take, IEnumerable`1 sort, Filter filter) in c:\Documents and Settings\nishantrana\My Documents\Downloads\KendoWCFGrid\App_Code\Products.cs:line 75
       at SyncInvokeRead(Object , Object[] , Object[] )
       at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
       at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
  InnerException: System.Data.SqlClient.SqlException
       Message=Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.
       Source=.Net SqlClient Data Provider
       ErrorCode=-2146232060
       Class=14
       LineNumber=65536
       Number=15372
       Procedure=""
       Server=.\SQLEXPRESS
       State=1
       StackTrace:
            at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
            at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
            at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
            at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
            at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject)
            at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout)
            at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
            at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
            at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
            at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
            at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
            at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
            at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
            at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
            at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
            at System.Data.SqlClient.SqlConnection.Open()
            at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure)
       InnerException:


Plz do let me know if I've missed something. 

Thanks and Regards
Nishant Rana
0
Rosen
Telerik team
answered on 08 Mar 2013, 07:39 AM
Hello Nishant,

The error does not seems to be related to KendoUI as it seems that the connection to the SQL server fails.

Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.

You can find information on the possible solution here or here.

Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Nishant
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Nishant
Top achievements
Rank 1
Share this question
or