Not able to save Master Page layout

Saravanan Gunasekaran asked on October 5, 2016 17:55

Hi, I am trying to edit master page layout, when i open and save, i get the below error:

Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Exception type: System.Web.HttpUnhandledException
    Stack Trace: 
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Message: Object reference not set to an instance of an object.

Exception type: System.NullReferenceException
Stack Trace: 
at CMS.DataEngine.SimpleDataClass.CopyOriginalDataTo(IDataClass target)
at CMS.DataEngine.AbstractInfoBase`1.Clone()
at CMS.DataEngine.AbstractInfoBase`1.Clone(Boolean clear)
at CMS.DataEngine.AbstractInfoBase`1.CloneObject(Boolean clear)
at CMS.FormControls.UIForm.UIForm_OnBeforeValidate(Object sender, EventArgs e)
at CMS.FormControls.BasicForm.ValidateData()
at CMS.FormControls.BasicForm.SaveData(String redirectUrlAfterSave, Boolean showChangesSaved)
at CMS.FormControls.UIForm.ObjectManager_OnSaveData(Object sender, SimpleObjectManagerEventArgs e)
at CMS.FormControls.CMSAbstractManager`2.RaiseSaveData(EventArgsType args)
at CMS.FormControls.CMSObjectManager.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Can anyone please help me to resolve this issue.

Note: I even edited the code directly in the database, still, it doesn't come out.

Recent Answers


Laura Frese answered on October 5, 2016 20:27 (last edited on October 5, 2016 20:27)

What exactly are you doing to edit the layout? are you adding some new code? a new zone with web parts? Try hiding any web parts on the page (Configuration / Visible) and each time you hide one, check to see if the page will load, that may narrow down the web part that is causing the error (if it is a web part causing it). If you have some code in your layout, post it here too.

0 votesVote for this answer Mark as a Correct answer

Saravanan Gunasekaran answered on October 5, 2016 20:31 (last edited on October 5, 2016 20:33)

Thank you Laura for responding. Initially I thought like that, but later, I tried by leaving blank space and got the same issue.

I am just trying to add links to social media icons.

Note: We have migrated the Kentico from 8 to 9 few months back.

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on October 5, 2016 20:46

Does your master page have multiple form tags in it? That can cause issues.

0 votesVote for this answer Mark as a Correct answer

Saravanan Gunasekaran answered on October 5, 2016 20:57

Master page Code

Layout element: Web part Zone

Layout Type: ASCX

<p class="skip-link" style="margin:0px;">
  <a href="#content-start" class="elementInvisible elementFocusable">Jump to main content</a>
</p>
<p class="skip-link" style="margin:0px;">
  <a href="#menu-start" class="elementInvisible elementFocusable">Jump to navigation</a>
</p>
<div class="boxed active"> 
  <!-- BEGIN .header -->
            <header class="header">
                <div class="header-topmenu"></div>

                <!-- BEGIN .wrapper -->
                <div class="wrapper">
                    <h1 style="margin-bottom:0px;">
                    <div class="header-block">
                        <div class="header-logo">
                            <a href="/"><img src="~/App_Themes/images/header-logo.png" /></a>
                        </div>
                      <div style="top:25%;"><cms:CMSWebPartZone ZoneID="zoneSearch" runat="server" /></div>
                    </div>
                    </h1>
                <!-- END .wrapper -->
                </div>

                <a id="menu-start" name="menu-start" tabindex="-1"></a>
                <nav class="main-menu">
                    <!-- BEGIN .wrapper -->
                    <div class="wrapper">
                          <!-- Menu -->
                          <cms:CMSWebPartZone ZoneID="zoneMenu" runat="server" />
                    <!-- END .wrapper -->
                    </div>
                </nav>

            <!-- END .header -->
            </header>

    <!-- Example row of columns -->
  <section class="content">
    <!-- BEGIN .wrapper -->
      <div class="wrapper">

          <!-- BEGIN .breaking-news -->
          <div class="breaking-news">
              <div class="breaking-title">
                  <span class="newsflashtitle">News Flash</span>
                  <i></i>
              </div>
              <div class="breaking-block">
                  <cms:CMSWebPartZone ZoneID="zoneNewsScrollerContent" runat="server" />                 
              </div>
          <!-- END .breaking-news -->
          </div>

      <!-- END .wrapper -->
      </div>

<!-- BEGIN .wrapper -->
      <div class="wrapper">
        <div class="right"> 
          <span id="sizeUp" class="cursor">A+</span> |
          <span id="normal" class="cursor">A</span> |
          <span id="sizeDown" class="cursor">A-</span>
        </div>
        <a id="content-start" name="content-start" tabindex="-1"></a>
        <cms:CMSWebPartZone ZoneID="zoneContent" runat="server" />              
      </div>
<!-- END .wrapper -->   
  </section>

     <!-- BEGIN .footer -->
            <footer class="footer">

                <!-- BEGIN .wrapper -->
                <div class="wrapper">

                    <!-- BEGIN .footer-widgets -->
                    <div class="footer-widgets">

                        <!-- BEGIN .widget -->
                        <div class="widget">
                            <div class="w-title">
                                <span class="FooterTitle">Contact Information</span>
                            </div>
                            <div>
                                <p>Address</p>
                            </div>
                        <!-- END .widget -->
                        </div>

                        <!-- BEGIN .widget -->
                        <div class="widget">
                            <div class="w-title">
                                <span class="FooterTitle">Mobile Apps</span>
                            </div>
                            <div class="tagcloud">
                                <a href="#"><span class="fa fa-android SocialMedia"></span><span class="elementInvisible">Android</span></a>
                                <a href="#"><span class="fa fa-apple SocialMedia"></span><span class="elementInvisible">Apple</span></a>
                            </div>
                        <!-- END .widget -->
                        </div>

                        <!-- BEGIN .widget -->
                        <div class="widget">
                            <div class="w-title">
                                <span class="FooterTitle">Social Media</span>
                            </div>
                            <div class="tagcloud">
                                <a href="#" target="_blank"><span class="fa fa-twitter SocialMedia" ></span></a>
                                <a href="#" target="_blank"><span class="fa fa-facebook SocialMedia" ></span></a>
                            </div>
                        <!-- END .widget -->
                        </div>

                    <!-- END .footer-widgets -->
                    </div>

                <!-- END .wrapper -->
                </div>

                <div class="footer-bottom">
                    <!-- BEGIN .wrapper -->
                    <div class="wrapper">
                        <ul class="right">
                            <li><a href="/">Home</a></li>
                            <li><a href="#">Website Usage FAQs</a></li>
                            <li><a href="#">Contact Us</a></li>
                            <li><a href="#">Careers</a></li>
                            <li><a href="#">Site Map</a></li>
                        </ul>
                        <div class="clear-float"></div>

                    <!-- END .wrapper -->
                    </div>
                </div>

            <!-- END .footer -->
            </footer>
</div>
<!-- Scripts -->
        <script type="text/javascript" src="~/CMSScripts/Custom/jquery-latest.min.js"></script>
        <script type="text/javascript" src="~/CMSScripts/Custom/theme-scripts.js"></script>
        <script type="text/javascript" src="~/CMSScripts/Custom/lightbox.js"></script>
        <script type="text/javascript" src="~/CMSScripts/Custom/jquery.ticker.js"></script>
0 votesVote for this answer Mark as a Correct answer

Saravanan Gunasekaran answered on October 5, 2016 22:07

I have solved it by creating a new master page - copy and paste the code. It worked. But, i m still confused why it did not work with the previous one.

0 votesVote for this answer Mark as a Correct answer

Saravanan Gunasekaran answered on October 11, 2016 21:38

I am getting the same error again with this new master page also. Can some help me with this please?

0 votesVote for this answer Mark as a Correct answer

Marco Glasbergen answered on November 29, 2016 14:41

I ran into the exact same problem last week using Kentico 9.0.45:

Exception type: System.NullReferenceException
Stack Trace: 
at CMS.DataEngine.SimpleDataClass.CopyOriginalDataTo(IDataClass target)
...

The master page for this website became unusable after the error and I had to use an earlier clone of the master page to rebuild it. I still have the corrupted master page, but can't find anything wrong (in the database). Any suggestions?

0 votesVote for this answer Mark as a Correct answer

Rene Guzman answered on January 4, 2017 15:59 (last edited on January 4, 2017 17:49)

I had the same issue with EMS 9.0.38:

Exception type: System.NullReferenceException Stack Trace: at CMS.DataEngine.SimpleDataClass.CopyOriginalDataTo(IDataClass target)

The Event URL referrer is /CMSModules/PortalEngine/UI/WebParts/webpartproperties_properties.aspx

Kentico support suggested clearing the cache. This worked and allowed successful saves. I am not clear on why clearing the cache worked but at least it is something to try.

2 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.