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

radgrid databind using WCF

17 Answers 232 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vittorio
Top achievements
Rank 1
Vittorio asked on 27 Feb 2014, 04:02 PM
Hi everyone, i have tried to create a web site asp.net including a radgrid (client side filtering), where databinding has made through a WCF service.
Project include a WcfService and the method GetDataAndCount of this WcfService is called for databinding by .aspx page with:  

<DataBinding Location="TelerikWcfService.svc" SelectMethod="GetDataAndCount"  SortParameterType="Linq" FilterParameterType="Linq"/>

I think I've correctly set up the web config with svc service data bindings.
Unfortunately, it doesn't work: on pageload, response is always 415 (Unsupported media type).

Any suggestions to solve the problem?
Thanks in advance

Regards
Vittorio

17 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 04 Mar 2014, 12:47 PM
Hi Vittorio,

It would be hard to determine the exact reason that is causing the error. You need to ensure that the service returns JSON in order for the RadGrid to be bound properly. If you would like you could also take a look at this online demo where using client-side binding with web service is illustrated.

If the error is still observed would you share your markup with the code-behind and the web service code? This would enable us to try replicating the issue locally and look for a solution.

Regards,
Viktor Tachev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Vittorio
Top achievements
Rank 1
answered on 04 Mar 2014, 02:47 PM
Hi Viktor,

JSON is not used in this project and I already took a look at this demo but it wasn't very usefull.

I have attached crucial points of the code of my website; the problem is that the code-behind of the service is never reached…I would be very grateful to you if you tried to replicate the issue to understand this behavior (if you prefer i could send to your email address the folder containing all the files and also the solution file).

Regards, thanks in advance

 
0
Viktor Tachev
Telerik team
answered on 07 Mar 2014, 11:25 AM
Hi Vittorio,

In order for the RadGrid to be bound on the client the data source needs to have a valid JSON signature. Please ensure that the data returned by the WebService is in JSON format. If you would like more information on client-side data binding it is available in this article.

This being said, I would appreciate if you could open a formal support and attach a runnable project where the issue is observed. This would allow us to investigate the problem locally and provide an appropriate solution.

Regards,
Viktor Tachev
Telerik

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

0
Vittorio
Top achievements
Rank 1
answered on 07 Mar 2014, 12:13 PM
Hi Viktor,
The problem that I've been talking about has been resolved; i did not define a wcf WITH AJAX SUPPORT to make databinding; now it works but my project is not still complete, i've another question for you.
I use this wcf also to implement checklist filtering on columns of the grid; i'd like to define just a single FilterCheckListWebServiceMethod for all the columns of the Radgrid and return a different list based on the name of the column from which that method has been called.
Is it possible? How can i pass the name of the column to this method? (the parameter Dictionary<string, object> context received by this method is empty).
0
Vittorio
Top achievements
Rank 1
answered on 07 Mar 2014, 03:31 PM
My purpose is to create a component (Telerik Web Site) that receive the dataset and create the table dinamically in the code behind, based on the content of the dataset; i don't know if this is possible...another problem could be the DataContract containing Datamember refferred to the name of the columns of DataSet...how can i create it? can you show me an example of RadGrid filterable created dinamically based on the content of dataset? 
Thank you in advance.
Regards.
0
Viktor Tachev
Telerik team
answered on 12 Mar 2014, 08:09 AM
Hello Vittorio,

When using checklist filtering you need to specify FilterCheckListWebServiceMethod for every column that would use such filtering. Also the CheckListWebServicePath should be set for the MasterTableView. This apporach is illustrated in an online demo here (check the second RadGrid).

Regarding your other question about adding data dynamically to a WebService there is a stackoverflow article here that discusses similar scenario. Give the approaches listed there a try and see which works best for you.

Regards,
Viktor Tachev
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
0
Vittorio
Top achievements
Rank 1
answered on 12 Mar 2014, 10:08 AM
Thanks a lot for you support Viktor, another important thing that I would like to know is: what is the parameter Dictionary<string, object> context received by every FilterCheckListWebServiceMethod in the demo you've posted to me?

Thanks in advance.

Regards.
0
Viktor Tachev
Telerik team
answered on 17 Mar 2014, 09:59 AM
Hello Vittorio,

Thank you for writing back.

The Dictionary parameter could be used internally by the RadListBox control that is rendered in the filtering menu for RadGrid. I am afraid, however, that currently when using the approach illustrated in the online demo for checkbox filtering you need to specify separate method that populates the data for the filter in every column.

I have logged a feature request for using a single method to populate the filter items and you could view it in our feedback portal here. You could also vote for the feature in order to increase its priority.

In order to have single method that populates the data for the filters in all columns you could use the following approach. Set the FilterCheckListEnableLoadOnDemand to true for the columns in RadGrid. When this property is enabled the FilterCheckListItemsRequested event will be thrown for every column in the grid. You could use its handler to populate the data for each column. Let me know if this approach is working for you.

If you need further assistance do not hesitate to contact us again.

Regards,
Viktor Tachev
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
0
Vittorio
Top achievements
Rank 1
answered on 17 Mar 2014, 05:26 PM
Thank you very much for your explanation Viktor! i was able to implement a partially flexible component that dynamically creates the grid based on a limited number of data that can be represented, and the use of the parameter "context" is fortunately not necessary.
0
Vittorio
Top achievements
Rank 1
answered on 18 Mar 2014, 05:53 PM
Just another question...is there a way to make sure that when the filter "checklist" is applied  to a table's column automatically checklists relating to the other columns of the table will resize automatically?

Thanks in advance!
0
Viktor Tachev
Telerik team
answered on 20 Mar 2014, 02:32 PM
Hello Vittorio,

I am glad to hear that you have implemented the required functionality.

I am afraid that limiting the checklist items in the filter menu based on previous filters when using WebService would not be possible.

You could try to implement such functionality by handling the FilterCheckListItemsRequested event for RadGrid. It is thrown for every column where the FilterCheckListEnableLoadOnDemand property is set to true. In the handler you would need to manually parse the FilterExpression for the RadGrid and populate checklist items based on the currently applied filters.

Regards,
Viktor Tachev
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
Vittorio
Top achievements
Rank 1
answered on 20 Mar 2014, 04:42 PM
Hi Viktor! the solution you proposed is exactly the one that I used; however it was much more complicated than expected achieve it (especially taking into account the management of particular cases such as multiple filters applied by users or duplicated values in this table). 
I want to ask you whether, in order to create filters of type "CheckList", the use of a WCF (what i use is not a WebService, is just a WCF with Ajax support) is the only way or there are others that allow you to save the code.

Thanks in advance!
0
Vittorio
Top achievements
Rank 1
answered on 20 Mar 2014, 06:01 PM
As for the solution i have just used, there's an important information i need to make everything work well: how can i set the property of a RadListBoxItemData object of the checklist to be checked? 
0
Viktor Tachev
Telerik team
answered on 25 Mar 2014, 09:16 AM
Hi Vittorio,

When the FilterCheckListEnableLoadOnDemand property for a column is enabled the items in the ListView could be defined manually in the OnFilterCheckListItemsRequested event handler. It is not necessary to use a WebService. Check the sample attached project that illustrates this approach.

In case you would like to apply a filter that should be applied initially you could use an approach similar to the one illustrated in this article.

Regards,
Viktor Tachev
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
Vittorio
Top achievements
Rank 1
answered on 25 Mar 2014, 11:22 AM
Hello Viktor, the example you sent me might help me a lot in order to achieve what I mean; unfortunately it doesn't work because the attribute "FilterCheckListEnableLoadOnDemand" is marked as not valid for "GridBoundColumn" .... I'm using the trial version 2013.3.1324.35/40 of Telerik.web.ui that I downloaded from the website .... can you tell me why the attribute isn't recognized as valid?
0
Vittorio
Top achievements
Rank 1
answered on 25 Mar 2014, 01:51 PM
If the reason is: beacuse the version of Telerik i'm using is obsolete, can you suggest me where to download the latest version, please.

Thanks in advance.
0
Viktor Tachev
Telerik team
answered on 27 Mar 2014, 03:27 PM
Hello Vittorio,

The FilterCheckListEnableLoadOnDemand property and the OnFilterCheckListItemsRequested event are available in our latest release (2014.1.225).

You could download a trial version of the controls after you login to our site. You need to navigate to Products & Subscriptions -> Trials -> Click "Download" next to UI for ASP.NET AJAX. You would then see a list with packages available for download.

Regards,
Viktor Tachev
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
Grid
Asked by
Vittorio
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Vittorio
Top achievements
Rank 1
Share this question
or