Compilation Error: while adding new ascx file

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 anni tempo fa
i want to add a new section on the homepage just like "information" "categories" etc
i created a new file in modules as "newsection.ascx
this is the code in my ascx file:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="NewTopic.ascx.cs" Inherits="NopSolutions.NopCommerce.Web.Modules.NewTopic" %>

<div class="block block-info">
    <div class="title">
        <%=GetLocaleResourceString("MyTopic.NewTopic")%>
    </div>
    <div class="clear">
    </div>
    <div class="listbox">
        <ul>
            <li><p>My Quote Here</p> </li>
          
        </ul>
    </div>
</div>

2) i also added "MyTopic.NewTopic" in the admin section > localization

3) in my master page left column i added this code:

<nopCommerce:NewTopic ID="NewTopic" runat="server" />

4) on the same masterpage i added this also:

<%@ Register TagPrefix="nopCommerce" TagName="NewTopic" Src="~/Modules/NewTopic.ascx" %>

5) Re-build the project

Now when i run the project i get this error:

Server Error in '/NopCommerceStore' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0103: The name 'GetLocaleResourceString' does not exist in the current context

Source Error:



Line 3:  <div class="block block-info">
Line 4:      <div class="title">
Line 5:          <%=GetLocaleResourceString("MyTopic.NewTopic")%>
Line 6:      </div>
Line 7:      <div class="clear">
13 anni tempo fa
Hi Mike,

You mentioned that you added 'MyTopic.NewTopic' into Localization.

In line 5 of your Source Error, it is 'MyTopic.Quote', instead of 'MyTopic.NewTopic'.

I hope that helps.

Let me know either way if that takes care of your problem.
13 anni tempo fa
paulh1971 wrote:
Hi Mike,

You mentioned that you added 'MyTopic.NewTopic' into Localization.

In line 5 of your Source Error, it is 'MyTopic.Quote', instead of 'MyTopic.NewTopic'.

I hope that helps.

Let me know either way if that takes care of your problem.


hi paulh1971
sorry it was my fault that i mentioned wrong, it is actually "MyTopic.NewTopic"
i just corrected that thing above...

so the problem remains the same...any solution ?
13 anni tempo fa
I believe I know what the problem is; I hope anyway. : )

Look in the NewTopic.ascx.cs code behind file.

Do you see a line that looks like this:
public partial class NewTopic : System.Web.UI.UserControl

If so, change it to:
public partial class NewTopicControl : BaseNopUserControl

Let me know if that works.
13 anni tempo fa
paulh1971 wrote:
I believe I know what the problem is; I hope anyway. : )

Look in the NewTopic.ascx.cs code behind file.

Do you see a line that looks like this:
public partial class NewTopic : System.Web.UI.UserControl

If so, change it to:
public partial class NewTopicControl : BaseNopUserControl

Let me know if that works.


hey paul,..guess what ? That worked !!!

Thanks a lot for pointing out that mistake...
13 anni tempo fa
No problem Mike,

Glad I could help!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.