Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

DotNetNuke Marketplace
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
OnyakTech
 


  Sponsors  

Meet Our Sponsors

Jango Studios - Skins, Modules and Hosting for DotNetNuke
eUKhost.com is commited to offer exceptional UK Windows Web Hosting solutions with quality 24x7 technical support.Our plans support ASP.Net, ASP, ASP.NET Ajax extensions, XML, MSSQL, MySQL, PHP,DNN, multiple domains and Shared SSL as standard.
SmarterTools
The Official Microsoft ASP.NET Website
Portal Webhosting - Hosting For Developers
Red-Gate Software
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Pass parameter to LoadControl
Previous Previous
 
Next Next
New Post 6/9/2008 8:13 AM
User is offline Declan Ward
145 posts
www.dws.ie
9th Ranked




Pass parameter to LoadControl 

My module may optionally load one or more of several user controls.

default view: list of options
User selects one or more options by clicking check boxes and then clicks "Go"

Based on options checked the appropriate user controls are dynamically loaded to a place holder using this code:

            Dim objPortalModuleBase As PortalModuleBase
            objPortalModuleBase = CType(Me.LoadControl(controlName), PortalModuleBase)
            objPortalModuleBase.ModuleConfiguration = Me.ModuleConfiguration
            objPortalModuleBase.ID = System.IO.Path.GetFileNameWithoutExtension(controlName)

            Me.phMain.Controls.Add(objPortalModuleBase)
           
I need to pass a parameter to each user control, on loading, in order to populate it with the correct data. How can this be done?

I have tried using v13wstat3 unsuccessfully and have read of problems with v13wstat3 between dynamically loaded controls. I do recall a solution but cannot find it when I search.

Declan


 
New Post 6/9/2008 8:30 AM
User is offline Brian Dukes
410 posts
www.engagesoftware.com
8th Ranked


Re: Pass parameter to LoadControl 

You'll need to know the type of the control beforehand, and set a property on that control after you instantiate it.

            Dim objPortalModuleBase As MyModule
            objPortalModuleBase = CType(Me.LoadControl(controlName), MyModule)
            objPortalModuleBase.ModuleConfiguration = Me.ModuleConfiguration
            objPortalModuleBase.ID = System.IO.Path.GetFileNameWithoutExtension(controlName)

            objPortalModuleBase.MyParameter = parameterValue

            Me.phMain.Controls.Add(objPortalModuleBase)

Does that make sense?


Brian Dukes
Engage Software
St. Louis, MO
314.966.4000

The leading provider of DotNetNuke support, training and custom module development.
 
New Post 6/9/2008 8:37 AM
User is offline Declan Ward
145 posts
www.dws.ie
9th Ranked




Re: Pass parameter to LoadControl 

Perfect sense, thank you. It works just as fine

 

 


 
New Post 7/10/2008 1:01 AM
User is offline teefa
0 posts
Unranked


Re: Pass parameter to LoadControl 

what if i can't see the class of the user control ?

 
New Post 7/10/2008 8:01 AM
User is offline Brian Dukes
410 posts
www.engagesoftware.com
8th Ranked


Re: Pass parameter to LoadControl 

That's going to cause some trouble.  Why can't you see the class of the control?


Brian Dukes
Engage Software
St. Louis, MO
314.966.4000

The leading provider of DotNetNuke support, training and custom module development.
 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Pass parameter to LoadControl
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


DNNhost Scandinavia
SUPER fast QuadCore DELL servers, MSSQL servers, DotNetPanel, daily backup, Check out our customers websites
DNNhost.dk
Personify Design, Inc.
Seattle-based Personify Design has developed customized DotNetNuke websites for a wide range of customers to meet many different types of needs, including distributed authorship across thousands of pages to integrated Verisign e-commerce capabilities.
www.personifydesign.com
DNN Outsourcing
50% more affordable services comparing to Western Europe and US: Custom DotNetNuke module development, skins, consulting, maintainence... Over 15.000 working hours of experience in custom DotNetNuke Solutions development, 8 years experience in outsourcing, excellent references!
www.dnnoutsourcing.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP