UserControls dynamically instantiation inside of SiteModuleControl

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
1/25/2011 5:01:22 PM
Gravatar
Total Posts 70

UserControls dynamically instantiation inside of SiteModuleControl

Hi All,

Question 1: Can I instantiate UserControls dynamically inside of SiteModuleControl? Something like this:

skipped.. switch (applModuleId)
            {
                case 1:
                    {  Control pd = LoadControl("Controls/PersonalData.ascx");
                        PlaceHolder1.Controls.Add(pd);
                        break; } skipped..

I've found some info about it and have a Question 2: Can I inherit Controls/PersonalData.ascx control from SiteModuleControl also or, as far as I could understand from the discussion mentioned, it will be the wrong way?

Also, could you pleas point me some Mojo Module as the example of  correct dynamically controls instantiation inside of SiteModuleControl?

 

Thank you in advance,

Best regards, Igor

 

1/26/2011 8:13:46 AM
Gravatar
Total Posts 70

Re: UserControls dynamically instantiation inside of SiteModuleControl

Well, after some testing of behavior been seems to work correctly beforehand I should say:

yes, actually the dynamic UserControls instantiation have a lot of problems including lost of events during postback etc and it is complex problem for sure. As far as my UserControls also have not too simple behavior including Grids, I've made a decision to redesign the solution architecture in turn to use the set of usual aspx pages with use declarative UserControl instantiation.

Best regards, Igor.

You must sign in to post in the forums. This thread is closed to new posts.