ITemplate InstantiateIn Not Firing when HTMLContent Feature on Page

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.
2/10/2011 1:54:33 PM
Gravatar
Total Posts 22

ITemplate InstantiateIn Not Firing when HTMLContent Feature on Page

I'm using VS2010 and latest build of mojoPortal (2.3.6.2) with .net 4.  I've got a feature which includes a devExpress ASPxGridView which is built on the fly and has columns which have templates in them. 

The feature works well outside mojoPortal and inside mojoPortal when it is in a page on its own.  When I add an HTMLContent item to the page it displays OK but if I then sort on a column or filter on a column the columns with templates don't display properly.  I've traced the code through and it turns out that the InstantiateIn for the columns with templates just doesn't fire as it should after the DataBind in the page load.  However, it works OK if I have an HTMLFragment on the page but not HTMLContent.  I haven't tried it with any other mojoPortal features yet.

I investigated the HTMLContent feature and by elimination have discovered that if I comment out the line

<portal:mojoRating runat="server" ID="Rating" Enabled="false" /> in the HTMLModule.ascx (and the three lines of supporting code in the .cs)

then it all works as it should. 

Any ideas what is in the mojoRating feature which might be causing this issue and how I can resolve it?

Any help would be appreciated.

Thank you

Suzy

 

 

2/11/2011 11:42:27 AM
Gravatar
Total Posts 18439

Re: ITemplate InstantiateIn Not Firing when HTMLContent Feature on Page

Hi Suzy,

If you are working from our source code repository, please get the latest code and see if it solves the problem. I don't really have a way to replicate this and I don't really have any idea why that control would break some other control, but I did make one small change this morning in mojoRating to use ScriptManager.RegisterClientScript instead of Page.ClientScript.RegisterClientScript. I don't know if that will impact the problem or not but it might.

If not, then I would request for you to experiment directly with mojoRating.ascx.cs and see if you can isolate what exactly in that control is causing the problem maybe by trial and error commenting things out directly in the control rather than in the Html module. If you can suggest a fix or at least isolate the code that is causing it then maybe we can find a solution.

Best,

Joe

2/11/2011 1:26:37 PM
Gravatar
Total Posts 22

Re: ITemplate InstantiateIn Not Firing when HTMLContent Feature on Page

Hi Joe

I tried with the latest source code and had the same problem so I've worked through as you suggested to try to isolate the line of code that causes the issue.  I've found that if I comment out the line

           Page.EnableViewState = true;

in the OnInit event in mojoRating.aspx.cs then it all works as I'd expect it to.  However, I don't know what effect that has on the Content Rating feature as I haven't got it enabled.

This seems really weird - any ideas of what might be going on.

Thanks for your help.

Suzy

2/11/2011 1:58:59 PM
Gravatar
Total Posts 18439

Re: ITemplate InstantiateIn Not Firing when HTMLContent Feature on Page

Hi Suzy,

Can you try changing the code like this and see if it makes any difference?

 

if (!Page.EnableViewState)
{
    Page.EnableViewState = true;
}
 
Best,
 
Joe
2/13/2011 8:59:57 AM
Gravatar
Total Posts 22

Re: ITemplate InstantiateIn Not Firing when HTMLContent Feature on Page

Hi Joe

I've tried what you suggested but it doesn't make any difference.  Sorry.

Suzy

2/13/2011 9:50:53 AM
Gravatar
Total Posts 18439

Re: ITemplate InstantiateIn Not Firing when HTMLContent Feature on Page

Hi Suzy,

Look for this in Web.config:

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

change it to false and see if that fixes it. if it does then try changing the code back as it was recompile and make sure it is still fixed.

Thanks,

Joe

2/13/2011 10:46:18 AM
Gravatar
Total Posts 22

Re: ITemplate InstantiateIn Not Firing when HTMLContent Feature on Page

Hi Joe

No luck with that either I'm afraid.  I've experimented a bit further and found that if I have Page.EnableViewState = true in either my control or in the mojoRating control I have the problem.  If I don't have Page.EnableViewState in either control it works correctly.  I don't need Page.EnableViewState in my control because each individual control within it has viewstate enabled.

I hope I've explained that OK.

Suzy

2/13/2011 12:22:06 PM
Gravatar
Total Posts 18439

Re: ITemplate InstantiateIn Not Firing when HTMLContent Feature on Page

Hi Suzy,

Can you try moving that code out of OnInit and into Page_Load and see if that has any impact?

Are the devexpress components you are using compiled for .NET 4 or .NET 3.5?

Also keeping the DisablePageViewStateByDefault set to false, try removing any code in your control that is setting it to enabled on your control, if it is enabled on the page it should already be enabled on the controls.

Hope it helps,

Joe

 

2/13/2011 1:34:05 PM
Gravatar
Total Posts 22

Re: ITemplate InstantiateIn Not Firing when HTMLContent Feature on Page

Hi Joe

Brilliant - that's fixed it!  I've put Page.EnableViewState in the Page_Init on my feature and am explicitly setting the EnableViewState property on the grid to false and it's all working.

Thanks for your help - beers are on the way.

Suzy

 

2/14/2011 10:30:36 AM
Gravatar
Total Posts 18439

Re: ITemplate InstantiateIn Not Firing when HTMLContent Feature on Page

Hi Suzy,

Glad its working for you now! And many thanks for the beers! Much appreciated.

Cheers,

Joe

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