Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Dynamically Add Module to page
luiz@wise.com.br
#1 Posted : Thursday, April 08, 2010 9:59:46 PM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 3/4/2010(UTC)
Posts: 157
Location: brazil
Is there a way to dynamically add a module to a page and set the properties?
zguoqi
#2 Posted : Thursday, April 08, 2010 10:32:09 PM(UTC)
Rank: Administration
Groups: Registered, Administrators

Joined: 9/2/2009(UTC)
Posts: 695
Location: xiamen
yes, of course.

You can use all those api methods in the templates. I dont remember exactly now, but it looks like

this.mypositiionid.Addmodule()
this.mypositionid.addContentTemplate.

Look for methods like those in the Visual Studio.NET
Regards,

Vincent

Kooboo Team
luiz@wise.com.br
#3 Posted : Thursday, April 08, 2010 11:57:22 PM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 3/4/2010(UTC)
Posts: 157
Location: brazil
I didn't find this methods
zguoqi
#4 Posted : Friday, April 09, 2010 2:40:59 AM(UTC)
Rank: Administration
Groups: Registered, Administrators

Joined: 9/2/2009(UTC)
Posts: 695
Location: xiamen
Do it in your visual studio.

Replace the mypositionid with your real position id.

For example in my layout template, I do it like below. I did not test the code, you should try it yourself

Code:

<script runat="server">

protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.left_sidebar.AddModule("mymodulename", "myid");
}

</script>


Regards,

Vincent

Kooboo Team
luiz@wise.com.br
#5 Posted : Friday, April 09, 2010 3:14:27 AM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 3/4/2010(UTC)
Posts: 157
Location: brazil
I was thinking that I could have a property in the content template that reference the current position and them use it to add the module
or in a ModuleViewUserControl

maybe if I explain what i'm doing I make it more clear, I have a news galery, and each news can have an image galery related, if the news had an galery I add the galery module in the news view, but they are in different modules

or another example is an rating control, so i could rate content, I could create a rating module and use it in diferent places
luiz@wise.com.br
#6 Posted : Tuesday, April 13, 2010 2:35:43 AM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 3/4/2010(UTC)
Posts: 157
Location: brazil
I'm still lost in this topic
zguoqi
#7 Posted : Tuesday, April 13, 2010 5:22:00 PM(UTC)
Rank: Administration
Groups: Registered, Administrators

Joined: 9/2/2009(UTC)
Posts: 695
Location: xiamen
Luiz,

The problem is that a Content template does not contains any position information and does not know any position in advanced. Only in the layout template, you can control positions and add modules.

Do you see possibility to add it at the layout template. It can be done the way you described, as long as it is a layout template.

Do this answer your question? Do not hesitate to ask again if there is still question
Regards,

Vincent

Kooboo Team
luiz@wise.com.br
#8 Posted : Tuesday, April 13, 2010 8:41:41 PM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 3/4/2010(UTC)
Posts: 157
Location: brazil
Can I pass parameters to a layout template?
zguoqi
#9 Posted : Wednesday, April 14, 2010 8:44:06 PM(UTC)
Rank: Administration
Groups: Registered, Administrators

Joined: 9/2/2009(UTC)
Posts: 695
Location: xiamen
Luiz,

I just checked, you does can add a position tag on a content template and the control them in the content template to add a module. Hope this might be easier for you.

You can viewdata to pass parameters.
Regards,

Vincent

Kooboo Team
luiz@wise.com.br
#10 Posted : Saturday, April 24, 2010 2:46:12 AM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 3/4/2010(UTC)
Posts: 157
Location: brazil
I didn't test this feature until today, it worked fine in the content template, thanks


Is there a way to get if some module is installed?
jifeng
#11 Posted : Monday, April 26, 2010 10:21:30 AM(UTC)
Rank: Administration
Groups: Administrators, Registered

Joined: 9/3/2009(UTC)
Posts: 1,555
Location: Xiamen China
luiz@wise.com.br

There is a property names "Installed" in ModuleConfiguration object, you can get a ModuleInfo object to catch the Installed value.

Code:


ModuleManager.GetModule(string moduleName, string runtimeApplication).Configuration.Installed
Regards,

Jifeng Huang

Kooboo Team

Microsoft ASP.NET MVP
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF 1.9.5.5 | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.547 seconds.