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  |  

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


  Ads  
The best choice for your web site host, email hosting, and domain registration.
 


  Sponsors  

Meet Our Sponsors

Portal Webhosting - Hosting For Developers
Red-Gate Software
MaximumASP
SourceGear - Tools for Developers
.: CounterSoft :.
telerik
 


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
411 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
411 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.

 


PointClick.Net DNN Solutions
DotNetNuke Hosting Platform for Business and personal use.
PointClick.Net Hosted Solutions
Advanced Web Portals by Infoscaler
Infoscaler is a California based company that provides advanced Web Portals, E-commerce Sites, Database Applications and Intranet Solutions on the DotNetNuke and Microsoft.NET platforms.
www.infoscaler.com
DotNetNuke® in Sweden
All service of DotNetNuke® in Sweden.
Olsmar Konsult

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