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.
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); } } }
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.
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); } } }
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. :)
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.