Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Using a specific Datatable within a Datasource bound to a dataset View modes: 
User avatar
Member
Member
gpending-yahoo - 4/17/2012 9:40:27 AM
   
Using a specific Datatable within a Datasource bound to a dataset
Hi all,
I am hoping you can help with something I would think should be simple, but it has me stumped at the moment.

I want to have multiple Kentico webparts point to one Datasource which contains a Dataset. The dataset (datasource) has several datatables in it and each webpart will point to one of the datatables within the dataset (datasource). Seems like it should be easy, I have created a prototype using Visual Studio 2010/C#/ASP.NET and it works fine. But I cannot seem to figure out how to get the individual Kentico webparts to point to a specific datatable within the datasource.

Anyone have ideas? I want to avoid creating custom webparts if possible.

Thanks in advance for your help.


User avatar
Member
Member
kentico_michal - 4/18/2012 6:44:03 AM
   
RE:Using a specific Datatable within a Datasource bound to a dataset
Hi,

Within Kentico CMS, the listing web parts (Repeater, Datalist, etc.) allows you to specify a data source web part, so you can use one data source web part in multiple listing web parts.

If you would like to expose a datasource from one web part and access it in other web parts, you might try to use the approach described in the following knowledge base article. The first web part could have a property DataSource that you can access just as mentioned in the article: How to change the properties of one web part from within another web part

Best regards,
Michal Legen

User avatar
Member
Member
gpending-yahoo - 4/18/2012 10:01:51 AM
   
RE:Using a specific Datatable within a Datasource bound to a dataset
Hi Michal,
Thank you for the reply.

If I understand the article correctly, it is to allow webparts to interact with each other? So one webpart could pass a value to another webpart?

If I have that correct, I can use that as part of my work-around but it does not solve the original problem. If I am misunderstanding please let me know.

The problem is that a kentico datasource cannot use a dataset which returns multiple datatables. And Kentico webparts cannot use a datasource which has multiple datables with the datasources dataset because it does not have an option to select which datatable to use for the webpart.

One option is to extend the Kentico webpart to allow it to use a datasource and select a specific datatable. Which the article you provided might tell me where to look for values within another webpart. I think I would also have to create a new datasource which accepts a dataset (containing multiple datatables). So it would be a multiple modifications if I use more then one webpart.

The second option would be to create a datasource that accepts a dataset that contains multiple datatables. And then a bridge datasource that points to the new dataset datasource. The bridge datasource would then be used by native Kentico webparts. I could just modify the few viewers webparts that I need for this project. But the problem with that is that I would have to modify any other webparts as I need. This way I could create 2 webparts and just use Kentico as is.

At least until Kentico sees this a good thing to have. I am surprised no one has brought this up before. Makes sense, 1 call to the database would return multiple datatables in 1 dataset. Thus saving multiple calls to the database and the network bandwidth it ties up.

If you have or anyone else has any other recommendations, comments please let me know. I can only benefit from others help.

Regards,
Garet

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 4/23/2012 6:11:32 AM
   
RE:Using a specific Datatable within a Datasource bound to a dataset
Hi,

here is a information for readers of this thread:

The system usually works with documents (for example product contains document data as well). The queries select data from 2 and more tables at once. The view containing information is used very often. But for documents it is better when data are merged, not separated in multiple DataTables in one DataSet. Additionally, we are using effective caching so the query to database is not needed so often.

Your requirement is quite specific and works with custom data. In case you have controls already implemented you can integrate them to Kentico, so the system will not be affected after hotfix or update and may become a part of installation.

The location which are exported are listed here:
Export locations

The link which describes how to safely modify code of the standard web part I already sent you. Then there is one web part which helps you to use custom controls in Kentico. It may be also useful for you. This web part allows to configure path to your custom control so it will be a part of Kentico:

User control web part


At the end I would like to show you the way how products can be displayed/filtered in Kentico natively.

Sorting products

Best regards,
Ivana Tomanickova