Compiler Error Message: CS0138

Last post 01-28-2009, 2:49 PM by gjorgenson. 3 replies.
Sort Posts: Previous Next
  •  01-28-2009, 1:11 PM 48163

    Compiler Error Message: CS0138

    I'm trying out the CuteEditor product for a .NET 2.0 application.  When I place the editor on a page, I get the following error message inside your editor:
     
    Compiler Error Message: CS0138: A using namespace directive can only be applied to namespaces; 'Robintek.Common'is a type not a namespace.
     
    Here's part of my web.config:
     
                <namespaces>
                    <clear/>
                    <add namespace="System"/>
                    <add namespace="System.Collections"/>
                    <add namespace="System.Collections.Specialized"/>
                    <add namespace="System.Configuration"/>
                    <add namespace="System.Text"/>
                    <add namespace="System.Text.RegularExpressions"/>
                    <add namespace="System.Web"/>
                    <add namespace="System.Web.Caching"/>
                    <add namespace="System.Web.SessionState"/>
                    <add namespace="System.Web.Security"/>
                    <add namespace="System.Web.Profile"/>
                    <add namespace="System.Web.UI"/>
                    <add namespace="System.Web.UI.WebControls"/>
                    <add namespace="System.Web.UI.WebControls.WebParts"/>
                    <add namespace="System.Web.UI.HtmlControls"/>
                    <add namespace="Robintek.Common"/>
                </namespaces>
     
    Here's part of my Robintek.Common namespace:
     
    Namespace Robintek
        Public Class Common
            Inherits Common_Application
     
    ...public shared functions etc...
     
        End Class

    End Namespace
     
    I understand that "common" is a class not a namespace, hence the error message.  What I don't understand is why this only errors inside your editor component and nowhere else in my application (and 20 other apps where I used the same technique).  I use this "Common" class for global functions used on nearly every page in my application.  It appears my only other option is to remove the line from web.config then add an Imports statement at the top of a hundred or so web pages.  Is there another option other than not buying your product? 
     
    Thanks!
     
     
     
     
     
     
     
  •  01-28-2009, 1:32 PM 48164 in reply to 48163

    Re: Compiler Error Message: CS0138

    Can you try the following code?
     
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <%@ Page language="c#"%>
    <html>
     <head>
     </head>
     <body>
      <form id="Form1" method="post" runat="server">
       <CE:EDITOR id="Editor1" Autoconfigure="Simple" runat="server"></CE:EDITOR>
      </form>
     </body>
    </html>

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  01-28-2009, 1:47 PM 48165 in reply to 48164

    Re: Compiler Error Message: CS0138

    I tried it.  There were fewer bars along the top of the editor, but still same error message.  Would it matter that my page language is VB and not C#?
  •  01-28-2009, 2:49 PM 48169 in reply to 48165

    Re: Compiler Error Message: CS0138

    I found what I did wrong and solved my own problem.
     
    In developing the application, there are a dozen or so functions I wanted to use throughout the application. Without knowing a better way,  I created  a class file in App_Code,  made a namespace called Robintek (my company name) and placed within it a "Public Class Common" That class contained nothing but shared functions.
     
    Next, I added a line to web.config namespaces as follows:
    <add namespace="Robintek.Common"/>
     
     Having done that, I could now use any function in that class without having to write any additional code.
     
     The right way, I just discovered, is to create a class file in App_Code folder.  Within that file, rather than creating a public class with shared functions, I created a "Public Module".   By using Module rather than class, all the functions contained within it are available to the entire application. 
     
    I recoded the "Common" file as a module rather than a class, then removed the namespace line from Web.config.  My application works as it did before and now the CuteEditor does not error.
     
    Thanks for looking into this, but the problem was mine and not yours!
     
    Gary Jorgenson, RN
    President/CEO Robin Technologies
     
     
     

     

View as RSS news feed in XML