Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Load WebPart Or Widget By ID View modes: 
User avatar
Member
Member
tabish.friend-gmail - 1/14/2010 5:46:25 AM
   
Load WebPart Or Widget By ID
hi


i want to show selected Widget in Pop up page (newly .aspx page) by providing its id in query string . Any body can help me in this .....


Bye

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 1/14/2010 8:58:01 AM
   
RE:Load WebPart Or Widget By ID
Hello,

you could create on ASPX page with all possible web parts/widgets. All of them would have the Visibility property configured like this:
http://devnet.kentico.com/FAQs/Web-parts---Controls/How-to-show-hide-webpart-on-specific-document-with.aspx
There would be a query macro instead of context macro (cmscontext.currentdocument.documentname). More information about macros is here: http://devnet.kentico.com/docs/devguide/appendix_a___macro_expressions.htm

For example it could look like:

{%id == "1"%}

Every web part/widget will have a different number of id in Visibility property. Then if you call the URL with the id query string it displays only the one requested web part/control.

Best regards,
Helena Grulichova

User avatar
Member
Member
tabish.friend-gmail - 1/14/2010 9:07:35 AM
   
RE:Load WebPart Or Widget By ID
Hi

thanks for reply.

Actually I want to add new page in VS 2008 (.aspx for e.g WebPartDetail.aspx) and then I want to use it in displaying particular web part by query string parameter.

I want to use only its control not page . So which controls are necessary to drop on new page. Whats the procedure plz...


User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 1/14/2010 9:33:11 AM
   
RE:Load WebPart Or Widget By ID
Hi,

if you are using ASPX templates you may not use the widgets. Otherwise, the approach may be the same as mentioned. You place the web parts (controls) on the page template and set up the visibility of controls according the query string in the code behind of page.

For example:
if (ValidationHelper.GetString(Request.QueryString["ReturnURL"], "") == controlID.ID)
controlID.Visible = true;

(Visible property should be false for all controls by default.)

More information about developing ASPX templates is here: http://devnet.kentico.com/docs/devguide/creating_a_new_aspx_page_template.htm

Best regards,
Helena Grulichova

User avatar
Member
Member
tabish.friend-gmail - 1/14/2010 10:56:16 PM
   
RE:Load WebPart Or Widget By ID
Hi

I have created new Aspx page template . Now I have to add all webparts on this template ....?

and then i have to set only its visible property true according to my requirements ..?


Thanks

Tabish Matin

User avatar
Member
Member
tabish.friend-gmail - 1/14/2010 11:08:03 PM
   
RE:Load WebPart Or Widget By ID
One more thing . i have created template just like example two table template

User avatar
Member
Member
tabish.friend-gmail - 1/14/2010 11:59:36 PM
   
RE:Load WebPart Or Widget By ID
Thanks For your help . Now i am understand how to show one webpart at a time.

Now the only problem is that . In my newly created template, what i have to add that will show me the option of adding webpart in CMS Desk .


Thanks

User avatar
Member
Member
tabish.friend-gmail - 1/15/2010 1:32:46 AM
   
RE:Load WebPart Or Widget By ID
New problem is that if I am selecting Article List then it shows empty

User avatar
Member
Member
Mujji - 1/17/2010 11:20:57 PM
   
RE:Load WebPart Or Widget By ID
HI Tabish.

i want to do the same thing by just adding a particular control.
Can you please share just this control logic with me... I'll be very thankful.

thanks
Mujeeb.


User avatar
Member
Member
tabish.friend-gmail - 1/18/2010 1:25:53 AM
   
RE:Load WebPart Or Widget By ID
Hi

According to Helena you have to add all webparts on a page and then set its visibility property according to your need.




Thanks
Tabish Matin

User avatar
Member
Member
Mujji - 1/18/2010 1:33:58 AM
   
RE:Load WebPart Or Widget By ID
Thx for the reply Tabish.

Ok i understand.
I'll add my custom made control tags on the page.
But how can i add the tags for the built-in webparts in CMS like Clock, Article, National Geo..

Do you have any idea?

Thx,
Mujeeb.

User avatar
Member
Member
tabish.friend-gmail - 1/18/2010 1:43:30 AM
   
RE:Load WebPart Or Widget By ID
No brother

I am also trying to do same thing.

main problem is that . when i try to load article list control it shows empty . no data loaded .

Kindly also share your solution , when you will done


Thanks
Tabish Matin

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 1/18/2010 6:57:40 AM
   
RE:Load WebPart Or Widget By ID
Hello,

1. adding web parts on ASPX page templates:
You may add the Kentico controls to Visual Studio toolbox:
http://devnet.kentico.com/Blogs/Thomas-Robbins/October-2009/Adding-Kentico-CMS-Controls-to-the-Toolbox.aspx

or find the path to controls in:

Site manager -> Development -> Web parts -> <edit> -> General -> File name

and register them as new controls on your template. All of them are in CMSWebParts folder.

If you are using ASPX templates you may not add web parts in CMSDesk (only Portal engine can). Please see here for more details:
http://devnet.kentico.com/docs/devguide/portal_templates_vs_aspx_templates.htm

2. Article list
Please check if you defined these properties:
Path
ClassNames
TransformationName
SelectedItemTransformationName


I would recommend you to install the sample Corporate site ASPX and go through the tutorial for ASPX templates:
http://devnet.kentico.com/docs/tutorial_aspx/index.html

I hope it will help.


Best regards,
Helena Grulichova

User avatar
Member
Member
tabish.friend-gmail - 1/18/2010 7:49:04 AM
   
RE:Load WebPart Or Widget By ID
HI

Thank you very much for yours precious help, now I can load data in article list and others.

Another problem is that when i am assigning value to control statictext.ascx

statictext1.Text ="some text"

it will show script .

If i direct copy that script to html page then it will show the webpart



Thanks

Tabish Matin

User avatar
Member
Member
Mujji - 1/18/2010 1:05:32 AM
   
RE:Load WebPart Or Widget By ID
Hi helena.

I'm little confused here.

How can i add all the widgets on the Page? and the question is why do i add all the controls. Can't i just use the id or name to get control on runtime?

I created the aspx templete as you mentioned above.

Kindly can you tell me please, what i do to call any widget on page by passing a query string.

Thx,
Mujeeb.

User avatar
Member
Member
Mujji - 1/18/2010 1:47:46 AM
   
RE:Load WebPart Or Widget By ID
Help us out here Helena.

We want to add the built-in CMS widgets like Clock, Articles, National Geo.... into our webpage. How can we accomplish that?

Thx,
Mujeeb.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 1/18/2010 7:12:38 AM
   
RE:Load WebPart Or Widget By ID
Hello Mujeeb,

First of all, the widgets do not work with ASPX templates only with Portal engine. You say you use the ASPX templates so you may not use the widgets.

The widgets neither web parts cannot be called by ID from query string directly. The ID is related to the concrete instance of control. The web parts are controls. (Widgets are web parts with limited properties.)

In every way you need to create the instances of controls - either create them dynamically or have all of them directly in the code and set their visibility. If the control is invisible it does not appear in rendered HTML code. I think the approach with visibility is more clear.


Best regards,
Helena Grulichova