User control loading to mojoBasePage vs mojoDialogBasePage

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.
5/27/2012 10:06:25 PM
Gravatar
Total Posts 28

User control loading to mojoBasePage vs mojoDialogBasePage

Hi,

I've an ascx user control with a telerik radgrid inside. I need to load this control dynamically to a page.

Originally I was using SiteModuleControl and was loading my ascx control in it, however there were problems after 1st postback - when paging used, on further pages selected rows don't work etc.

Then I setup a mojoBasePage which resulted with the same problems.

After that I changed it to mojoDialogBasePage and all works fine.

Seems to me that there are some problems with maintaining the viewstate on SiteModuleControl or mojoBasePage.

Also tested basic aspx page and all works fine too.

My prefered option would be to use SiteModuleControl.

Thanks for any help on this issue.

Peter

5/28/2012 11:49:55 AM
Gravatar
Total Posts 18439

Re: User control loading to mojoBasePage vs mojoDialogBasePage

If you're targeting .NET 3.5 you may need to add this to user.config:

<add key="DisablePageViewStateByDefault" value="false"/>

or in code of your feature:

Page.EnableViewState = true;

Hope that helps,

Joe

5/28/2012 10:18:24 PM
Gravatar
Total Posts 28

Re: User control loading to mojoBasePage vs mojoDialogBasePage

Thank you Joe,

Just to clarify what I'm running. I'm on the latest version 2.3.8.5 on .Net 4.0

Here is a part of the code. It is same on page or control. My user control contains a telerik grid.

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        this.Load += new EventHandler(Page_Load);
        Page.EnableViewState = true;
        if (Panel1.FindControl("myUC") == null)
        {
            Control myControl = this.LoadControl("FS_ClientMnt.ascx");
            myControl.ID = "myUC";
            this.Panel1.Controls.Add(myControl);
        }

   }
 

It works perferct only on aspx page iherited from mojoDialogBasePage using master page DialogMaster.Master.

It doesn't work on aspx page iherited from mojoBasePage, also it doesn't work on ascx control inherited from SiteModuleControl.

My main goal is to be able to set this up as a SiteModuleControl

I'm really lost with this.

Thanks again

 

 

5/29/2012 7:04:08 AM
Gravatar
Total Posts 18439

Re: User control loading to mojoBasePage vs mojoDialogBasePage

There are usually lots of things needed to use Telerik controls, Web.config settings, you may need to replace ScriptManager in layout.master with the Telerik one. I can't really offer support for Telerik products but there is no reason you can't use them in mojoPortal. If you use the forum search and search for Telerik you may find some tips from others who have managed to use Telerik controls.

Things can be tricky with dynamically loaded controls, when you consider that the ModuleControl itself is loaded dynamically and then your custom UserControl is loaded dynamically inside it. In some cases it may be easier instead of loading your inner UserControl dynamcially to just embed it directly and set the .Visible property on it to true when using it and false when not using it. Then internal to your usercontrol make sure it isn't hitting the database except when it is visible.

Hope that helps,

Joe

5/29/2012 6:02:48 PM
Gravatar
Total Posts 28

Re: User control loading to mojoBasePage vs mojoDialogBasePage

Thanks Joe,

I guess I'll go with mojoDialogBasePage as it works correctly on that.

Regards,

Peter

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