Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Setting web part properties per page. View modes: 
User avatar
Member
Member
Armysniper89 - 10/25/2011 2:28:11 PM
   
Setting web part properties per page.
I have a page template that has a custom data repeater on it. I want to be able to set the "WHERE" clause (not using a filter) on each page where this template is used but doing so would make the change for all page templates. Is there a way in 5.5 to do this for each instance of the page?

User avatar
Member
Member
Armysniper89 - 10/26/2011 1:29:42 PM
   
RE:Setting web part properties per page.
Nobody? I figured this would be a common enough quest that I would get a quick response to this one!

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 10/27/2011 4:56:20 AM
   
RE:Setting web part properties per page.
Hi,

Please read this KB article to get the meaning of what template is. Web part is part of the page template - so the settings are shared since they are on one page template and this one template is used by multiple documents.

Option one is to create separate page templates and option two is to create a custom macro which will be added to the web part configuration and in the code you will check the current document/page and set the value of the macro according your needs.

Best regards,
Juraj Ondrus

User avatar
Member
Member
lancetek - 10/27/2011 4:25:03 AM
   
RE:Setting web part properties per page.
Please provide examples of your intentions... it's much easier to come up with a valid answer when we have more info!

You can of course create a custom function to populate the Where clause based on whatever parameters you want... but that's a bit vague an answer!

User avatar
Member
Member
Armysniper89 - 10/27/2011 10:17:15 AM
   
RE:Setting web part properties per page.
I think I did that pretty well. I have a page template that displays a repeater of content from a custom table...need to be able to change the where clause of the web part on each page that uses the template and would like to avoid having adhocs of this.

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 10/27/2011 10:51:12 AM
   
RE:Setting web part properties per page.
When you are using a web part on a template, that web part's settings will be used on all pages that use that template. You cannot have different settings for the web part for each page that uses that template because the web part is part of the template, not the page (it's saved in the template data, not the page data). This is as it should be.

However, you can have dynamic variables in your settings if you use macros. You can use any contextual data available to you on each page in the where clause on the web part. If you need to, you can create a custom macro that you can pass a variable to that you can use to return the appropriate where clause for each page.

Keep in mind that you can use macro expressions for most settings of web parts to use the context to change the settings.

User avatar
Member
Member
euan-ionwerks.co - 3/8/2012 5:23:54 PM
   
RE:Setting web part properties per page.
Being new to Kentico I recently had to solve this problem as well.

In my case I had created a Custom Table of information of a globe spanning companys offices wanting to show that information in global and regional pages.

The regional pages are based on a Region Map Template I created with a repeater listing offices in a region.

I did it by making each page a Map Document where that is a document type I created with a RegionID field. So each page knows its region.

Then in the repeater query WHERE clause I wrote:
office_table.region = {% RegionID %}

Thus restricting the query on office information to the documents region.

User avatar
Member
Member
nikunj.it007-gmail - 4/3/2012 6:22:16 AM
   
RE:Setting web part properties per page.
Hiii euan-ionwerks.co,

i tried same way but it's not working for me.is there any another setting available??

1.) BookingEventID = {% id %}
2.)CONVERT(VARCHAR(11),EventDate,110) = {% EventDate %}

above 2 syntax i tried but none of these are working.can u please tell me where i am wrong or is there any setting ?? actually i want implement 2 option.i want pass dynamic date in where condition.it's not working even i put this syntax in where clause of content slider it throws directly error.[img]http://http://121.247.170.47/irelief/Error.jpg[/img]


User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 4/4/2012 3:52:38 AM
   
RE:Setting web part properties per page.
Hi,

1.

Have you called the page using:

http://your_domain.com/page.aspx?id=8

Then the where condition in repeater web part should be configured as

BookingEventID={id|(toint)0}

It ensures that only event with provided id will be displayed by repeater providing that the event is displayed by default with other events by repeater and its configuration is correct.

As for datetime? Could you please tell mi in which format is EventDate query parameter passed to the page?

Best regards,
Ivana Tomanickova

User avatar
Member
Member
nikunj.it007-gmail - 4/4/2012 9:20:44 AM
   
RE:Setting web part properties per page.
Hi,
thanks for your reply.but i did by see example in given "Personal site".same way as you told it's works.but for date i was not successful.but finally i did this way
MONTH(EventDate) = {%ToInt(M, "")%} AND YEAR(EventDate)={%ToInt(Y, "")%} AND DAY(EventDate)={%ToInt(D, "")%}