add new page

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 years ago
I am trying to build a new page that I can change the Master page.  I added a topic and named it zzTest.  I added a resource string and named it PageTitle.zzTest and gave it a resource value of zzTest.  

I copied the aboutUs.aspx and aboutUs.cs and renamed them zzTest.aspx and zzTest.cs. I also changed the named attributes in each file as shown below.  The page seems to work but my question is how do I change the Inherits  statement to “Inherits="NopSolutions.NopCommerce.Web.zzTest"?  When I use this statement I receive an error and the page will not load, but the page does load when I keep the “aboutUsPage” in the statement.

Chad

Aspx page;

<%@ Page Language="C#" MasterPageFile="~/MasterPages/OneColumn.master" AutoEventWireup="true"
    Inherits="NopSolutions.NopCommerce.Web.AboutUsPage" Codebehind="zzTest.aspx.cs" %>

<%@ Register TagPrefix="nopCommerce" TagName="Topic" Src="~/Modules/Topic.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cph1" runat="Server">
    <nopCommerce:Topic ID="topiczzTest" runat="server" TopicName="zzTest">
    </nopCommerce:Topic>
</asp:Content>

************and**************
.CS page;

using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Text;
using System.Web;
using System.Web.Caching;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using NopSolutions.NopCommerce.BusinessLogic;
using NopSolutions.NopCommerce.BusinessLogic.Localization;
using NopSolutions.NopCommerce.BusinessLogic.Payment;
using NopSolutions.NopCommerce.BusinessLogic.SEO;
using NopSolutions.NopCommerce.Common.Utils;

namespace NopSolutions.NopCommerce.Web
{
    public partial class zzTest : BaseNopPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CommonHelper.EnsureNonSSL();
            }

            string title = GetLocaleResourceString("PageTitle.zzTest");
            SEOHelper.RenderTitle(this, title, true);
        }
    }
}
14 years ago
public partial class zzTest : BaseNopPage
looksgood on codebehind page


Inherits="NopSolutions.NopCommerce.Web.zzTest "
on  .aspx page

save both, then  you must re-compile the code
14 years ago
Thank you for your response.  I used "Inherits="NopSolutions.NopCommerce.Web.zzTest" codebehind="zzTest.aspx.cs" %>", clicked save,  then in  VS2008 I clicked build page, then I recieved an error list with "could not load type  'NopSolutions.NopCommerce.Web.zzTest'.  I also tried Rebuild website just to see if it would make a difference but I still recieved the same error.

Chad
14 years ago
i re-read what you wrote - i wonder, when you say you copied one page then the other, did you do that separately ?
14 years ago
Yes, I copied the .aspx page, then I copied the .cs page, then I renamed the .aspx page, then I renamed the .cs page.

Chad
14 years ago
ok, i think thats where you went wrong - assuming you are using vs or vwd -  i think you are editing the wrong .cs page, i think you should start over

- delete the two pages you copied

then right click another page to copy - aboutus.aspx for example - then right click nopcommercestore and select paste

the new page will be called copy of aboutus.aspx - the cs page is already copied for you, you don't copy this separately
14 years ago
I am using Visual Studio 2008 Pro ~ I am trying to create a new page by copying and pasting the aboutus.aspx page, then changing the named attributes within the .aspx page and the .cs page.  

I did as you suggested by deleting the old test pages and creating new ones by copying them both together, then pasting the pages in the highest directory, then renaming together as well.  I am still recieving the same error "Parser Error Message: Could not load type 'NopSolutions.NopCommerce.Web.ZZZTestPage'."  However, when I change the statement to "Inherits="NopSolutions.NopCommerce.Web.AboutUsPage" Codebehind="ZZZTest.aspx.cs" %>" the ZZZTest page will load and work correctly.
****************
<%@ Page Language="C#" MasterPageFile="~/MasterPages/OneColumn.master" AutoEventWireup="true"
    Inherits="NopSolutions.NopCommerce.Web.ZZZTestPage" Codebehind="ZZZTest.aspx.cs" %>

<%@ Register TagPrefix="nopCommerce" TagName="Topic" Src="~/Modules/Topic.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cph1" runat="Server">
    <nopCommerce:Topic ID="ZZZTest" runat="server" TopicName="ZZZTest">
    </nopCommerce:Topic>
</asp:Content>
*****************
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Text;
using System.Web;
using System.Web.Caching;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using NopSolutions.NopCommerce.BusinessLogic;
using NopSolutions.NopCommerce.BusinessLogic.Localization;
using NopSolutions.NopCommerce.BusinessLogic.Payment;
using NopSolutions.NopCommerce.BusinessLogic.SEO;
using NopSolutions.NopCommerce.Common.Utils;

namespace NopSolutions.NopCommerce.Web
{
    public partial class AboutUsPage : BaseNopPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CommonHelper.EnsureNonSSL();
            }

            string title = GetLocaleResourceString("PageTitle.ZZZTest");
            SEOHelper.RenderTitle(this, title, true);
        }
    }
}
14 years ago
NopSolutions.NopCommerce.Web.AboutUsPage works, because  the partial class 'AboutUsPage' exists

looking at your last post, in your new zzztest codebehind:

public partial class AboutUsPage : BaseNopPage
must read
public partial class ZZZTestPage : BaseNopPage
14 years ago
Hey, I created the file as per you instruction above. Unfortunately, there is still same error showing to me. Could you kindly help?

I copied AboutUs page and paste it under NopCommerceStore. I renamed it as AboutTW.

Code in AboutTW.aspx:
<%@ Page Language="C#" MasterPageFile="~/MasterPages/TwoColumn.master" AutoEventWireup="true"
    Inherits="NopSolutions.NopCommerce.Web.AboutTWPage" Codebehind="AboutTW.aspx.cs" %>

<%@ Register TagPrefix="nopCommerce" TagName="Topic" Src="~/Modules/AboutUs.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cph1" runat="Server">
    <nopCommerce:Topic ID="topicAboutTW" runat="server" TopicName="AboutTW">
    </nopCommerce:Topic>
</asp:Content>

Code in AboutTW.aspx.cs:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Text;
using System.Web;
using System.Web.Caching;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using NopSolutions.NopCommerce.BusinessLogic;
using NopSolutions.NopCommerce.BusinessLogic.Localization;
using NopSolutions.NopCommerce.BusinessLogic.Payment;
using NopSolutions.NopCommerce.BusinessLogic.SEO;
using NopSolutions.NopCommerce.Common.Utils;

namespace NopSolutions.NopCommerce.Web
{
    public partial class AboutTWPage : BaseNopPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CommonHelper.EnsureNonSSL();
            }

            string title = GetLocaleResourceString("PageTitle.AboutTW");
            SEOHelper.RenderTitle(this, title, true);
        }
    }
}



I inserted a new record in this table "Nop_LocaleStringResource" with ResourceName="PageTitle.AboutTW" and ResourceValue = "About The WINE".

May I know what other things I miss? Please advise. Many many thanks. :)
14 years ago
It didn't work for me until I created a new page from a master page then copied the AboutUs.aspx and AboutUs.cs source and pasted it into the new page.  Then lastly, changed the attributes.

Chad
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.