YAFLogo

youtpout
  • youtpout
  • 53.6% (Neutral)
  • YAF Forumling Topic Starter
10 years ago
Hello,

i have integrated forum in masterpage, it worked with v 1.9.6RC1 and 1.9.5.5 but not with v1.9.6.1

error:


[NullReferenceException: La référence d'objet n'est pas définie à une instance d'un objet.]
   YAF.Modules.PagePopupForumModule.InitAfterPage() +35
   YAF.Modules.SimpleBaseForumModule.ForumControl_AfterForumPageLoad(Object sender, YafAfterForumPageLoad e) +10
   System.EventHandler`1.Invoke(Object sender, TEventArgs e) +0
   YAF.Forum.OnLoad(EventArgs e) +1211
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Control.LoadRecursive() +146
   System.Web.UI.Control.LoadRecursive() +146
   System.Web.UI.Control.LoadRecursive() +146
   System.Web.UI.Control.LoadRecursive() +146
   System.Web.UI.Control.LoadRecursive() +146
   System.Web.UI.Control.LoadRecursive() +146
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

the code of my page:


<%@ Page Title="" Language="C#" MasterPageFile="~/MenuSecondaire.master" AutoEventWireup="true"
    CodeFile="Forum.aspx.cs" Inherits="Forum" %>

<%@ Register TagPrefix="YAF" Assembly="YAF" Namespace="YAF" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Content3" runat="Server">
    <div class="forum">
        <YAF:Forum runat="server" ID="forum" BoardID="1"></YAF:Forum>
    </div>
</asp:Content>

Have you any solution?

Sponsor

youtpout
  • youtpout
  • 53.6% (Neutral)
  • YAF Forumling Topic Starter
10 years ago
i found the problem and correct him in source code (the page bug when i have script manager in masterpage)

in class PagePopupForumModule


/// <summary>
        /// The init after page.
        /// </summary>
        public override void InitAfterPage()
        {
            if (this._errorPopup == null)
                AddErrorPopup();
            this._errorPopup.Title = this.GetText("COMMON", "MODAL_NOTIFICATION_HEADER");
            this.CurrentForumPage.PreRender += this.CurrentForumPage_PreRender;
        }
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 3.0.3
10 years ago
Originally Posted by: youtpout 

i found the problem and correct him in source code (the page bug when i have script manager in masterpage)

in class PagePopupForumModule


/// <summary>
        /// The init after page.
        /// </summary>
        public override void InitAfterPage()
        {
            if (this._errorPopup == null)
                AddErrorPopup();
            this._errorPopup.Title = this.GetText("COMMON", "MODAL_NOTIFICATION_HEADER");
            this.CurrentForumPage.PreRender += this.CurrentForumPage_PreRender;
        }

Thanks, this should be fixed now in the repository. Now the Notifcations should work in all cases.

archi
  • archi
  • 50.6% (Neutral)
  • YAF Camper
10 years ago
Hi

I Just downloaded the latest 1.9.6.1 version today and integrated it into my site (an upgrade - i was using 1.9.5.5).

But I'm having the same problem as above - if theres a script manager on my master page it won't work. Is there a fix for this? Do I need to be running the source code version to fix it myself?

Thanks.

daveburke
10 years ago
Originally Posted by: archi 

if theres a script manager on my master page it won't work. Is there a fix for this? Do I need to be running the source code version to fix it myself?

The control loads a ScriptManager in OnInit(), so you'll need to fold any ScriptManager services or scripts into it.

Hope that helps.

-Dave

archi
  • archi
  • 50.6% (Neutral)
  • YAF Camper
10 years ago
Originally Posted by: daveburke 

so you'll need to fold any ScriptManager services or scripts into it.

Thanks, but I don't know what that means. A little more explanation would be much appreciated.

gonso
  • gonso
  • 50.2% (Neutral)
  • YAF Forumling
10 years ago
Originally Posted by: daveburke 

The control loads a ScriptManager in OnInit(), so you'll need to fold any ScriptManager services or scripts into it.

Hope that helps.

-Dave

I´m having the same problem with the masterpage scriptmanager due to a telerik control that needs the scriptmanager on the masterpage.

Is there a way to avoid YAF:Forum control loading the scriptmanager and make it use the one in the masterpage?

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 3.0.3
10 years ago
Originally Posted by: gonso 

Originally Posted by: daveburke 

The control loads a ScriptManager in OnInit(), so you'll need to fold any ScriptManager services or scripts into it.

Hope that helps.

-Dave

I´m having the same problem with the masterpage scriptmanager due to a telerik control that needs the scriptmanager on the masterpage.

Is there a way to avoid YAF:Forum control loading the scriptmanager and make it use the one in the masterpage?

The only way is to update the code and recompile yaf.

gonso
  • gonso
  • 50.2% (Neutral)
  • YAF Forumling
10 years ago
Thanks tha_watcha

This is what I did taking the advice from tha_watcha:

I commented out this lines of code from Forum.cs in the Classes Folder from Yaf inside the OnInit function

// handle script manager first...

if (ScriptManager.GetCurrent(this.Page) != null)

{

return;

}

//// add a script manager since one doesn't exist...

var yafScriptManager = new ScriptManager { ID = "YafScriptManager", EnablePartialRendering = true };

this.Controls.Add(yafScriptManager);

This avoids Yaf adding a new scriptmanager to the page (as I´m sure I´m adding one in my master page).

Recompiled the whole project.

Copied all the files in Yaf bin directory into my solution bin directory.

And now it seems to work perfectly... I´ll inform if I find any problem.

toregua
  • toregua
  • 50.6% (Neutral)
  • YAF Camper
9 years ago
Originally Posted by: gonso 

Thanks tha_watcha

This is what I did taking the advice from tha_watcha:

I commented out this lines of code from Forum.cs in the Classes Folder from Yaf inside the OnInit function

// handle script manager first...

if (ScriptManager.GetCurrent(this.Page) != null)

{

return;

}

//// add a script manager since one doesn't exist...

var yafScriptManager = new ScriptManager { ID = "YafScriptManager", EnablePartialRendering = true };

this.Controls.Add(yafScriptManager);

This avoids Yaf adding a new scriptmanager to the page (as I´m sure I´m adding one in my master page).

Recompiled the whole project.

Copied all the files in Yaf bin directory into my solution bin directory.

And now it seems to work perfectly... I´ll inform if I find any problem.

Thank you very much 😃 It works for me too ! You save my day :)