Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Can't use namespaces for ASP.NET pages...

Can't use namespaces for ASP.NET pages...

Scheduled Pinned Locked Moved ASP.NET
csharphelpasp-netquestion
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    signbit
    wrote on last edited by
    #1

    Hello, I am getting a strange problem in my projects (ASP.NET/C#), whenever I try to put the classes into a namespace, an error is generated saying that it cannot resolve the symbol i.e.

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>

    works fine, but

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyNamespace.MyPage" %>

    doesn't! any ideas why this might be happening? Warmest Regards,

    - A programmer's national anthem; "AAAAAHHHHH!!!!"

    T S 2 Replies Last reply
    0
    • S signbit

      Hello, I am getting a strange problem in my projects (ASP.NET/C#), whenever I try to put the classes into a namespace, an error is generated saying that it cannot resolve the symbol i.e.

      <%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>

      works fine, but

      <%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyNamespace.MyPage" %>

      doesn't! any ideas why this might be happening? Warmest Regards,

      - A programmer's national anthem; "AAAAAHHHHH!!!!"

      T Offline
      T Offline
      thomasa
      wrote on last edited by
      #2

      Does the code behind look something like this? using System; using System.Data; namespace MyNamespace { public class MyPage : System.Web.UI.Page { private void Page_Load(object sender, System.EventArgs e) {

      S 1 Reply Last reply
      0
      • S signbit

        Hello, I am getting a strange problem in my projects (ASP.NET/C#), whenever I try to put the classes into a namespace, an error is generated saying that it cannot resolve the symbol i.e.

        <%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>

        works fine, but

        <%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyNamespace.MyPage" %>

        doesn't! any ideas why this might be happening? Warmest Regards,

        - A programmer's national anthem; "AAAAAHHHHH!!!!"

        S Offline
        S Offline
        Sandeep Akhare
        wrote on last edited by
        #3

        Code file contains the Code Behind file name for your aspx page And in the Inherits property you should give full name of your code behind class including the namespace that you have for your project i think you are working in VS 2005 and you added a namespace for your application

        Thanks and Regards Sandeep If you want something you never had, do something you have never done!

        S 1 Reply Last reply
        0
        • T thomasa

          Does the code behind look something like this? using System; using System.Data; namespace MyNamespace { public class MyPage : System.Web.UI.Page { private void Page_Load(object sender, System.EventArgs e) {

          S Offline
          S Offline
          signbit
          wrote on last edited by
          #4

          Well, yes, it does look like it... why? is it wrong? Warmest Regards,

          - A programmer's national anthem; "AAAAAHHHHH!!!!"

          1 Reply Last reply
          0
          • S Sandeep Akhare

            Code file contains the Code Behind file name for your aspx page And in the Inherits property you should give full name of your code behind class including the namespace that you have for your project i think you are working in VS 2005 and you added a namespace for your application

            Thanks and Regards Sandeep If you want something you never had, do something you have never done!

            S Offline
            S Offline
            signbit
            wrote on last edited by
            #5

            Thanks, and yes it is so, but what is the fix? :)

            - A programmer's national anthem; "AAAAAHHHHH!!!!"

            S 1 Reply Last reply
            0
            • S signbit

              Thanks, and yes it is so, but what is the fix? :)

              - A programmer's national anthem; "AAAAAHHHHH!!!!"

              S Offline
              S Offline
              Sandeep Akhare
              wrote on last edited by
              #6

              That i can't say where have you gone wrong Did you give same namespace for all classes in the application or can you post your namespace and class name

              Thanks and Regards Sandeep If you want something you never had, do something you have never done!

              S 1 Reply Last reply
              0
              • S Sandeep Akhare

                That i can't say where have you gone wrong Did you give same namespace for all classes in the application or can you post your namespace and class name

                Thanks and Regards Sandeep If you want something you never had, do something you have never done!

                S Offline
                S Offline
                signbit
                wrote on last edited by
                #7

                Yes, it's like (NOTE: I am typing it by hand (as the code is not in my laptop right now), so please ignore any syntax errors )

                namespace LSW
                {
                class SignUp : System.Web.UI.Page
                {
                ...........
                ...........

                and I trying to access it with inherits="LSW.SignUp" which throws unresolved symbol error. strangely enough, as soon as I remove the namespace (from both the class and the inherits attribute), the code starts to work... Warmest Regards,

                - A programmer's national anthem; "AAAAAHHHHH!!!!"

                S 1 Reply Last reply
                0
                • S signbit

                  Yes, it's like (NOTE: I am typing it by hand (as the code is not in my laptop right now), so please ignore any syntax errors )

                  namespace LSW
                  {
                  class SignUp : System.Web.UI.Page
                  {
                  ...........
                  ...........

                  and I trying to access it with inherits="LSW.SignUp" which throws unresolved symbol error. strangely enough, as soon as I remove the namespace (from both the class and the inherits attribute), the code starts to work... Warmest Regards,

                  - A programmer's national anthem; "AAAAAHHHHH!!!!"

                  S Offline
                  S Offline
                  Sandeep Akhare
                  wrote on last edited by
                  #8

                  Yes it happenes many times in 2005 you have partial class and class will not put in any namespace by default see the code namespace MyNameSpace { public partial class ForumTest : System.Web.UI.Page { int a = 0; string[] str ={ "January", "February", "March", "April" }; strin and aspx page contains <%@ Page Language="C#" EnableViewState="true" AutoEventWireup="true" CodeFile="ForumTest.aspx.cs" Inherits="MyNameSpace.ForumTest" %> see all properties are rigth set Again i alsp don't have answer to this but when i added namspace in my application it is rumming fine although i faced same problem few months before . No sooner did i got the answer i will let yoy know if you have do the same

                  Thanks and Regards Sandeep If you want something you never had, do something you have never done!

                  S 1 Reply Last reply
                  0
                  • S Sandeep Akhare

                    Yes it happenes many times in 2005 you have partial class and class will not put in any namespace by default see the code namespace MyNameSpace { public partial class ForumTest : System.Web.UI.Page { int a = 0; string[] str ={ "January", "February", "March", "April" }; strin and aspx page contains <%@ Page Language="C#" EnableViewState="true" AutoEventWireup="true" CodeFile="ForumTest.aspx.cs" Inherits="MyNameSpace.ForumTest" %> see all properties are rigth set Again i alsp don't have answer to this but when i added namspace in my application it is rumming fine although i faced same problem few months before . No sooner did i got the answer i will let yoy know if you have do the same

                    Thanks and Regards Sandeep If you want something you never had, do something you have never done!

                    S Offline
                    S Offline
                    signbit
                    wrote on last edited by
                    #9

                    Thanks Sandeep, I'll be obliged. :) hope to hear from u soon...

                    - A programmer's national anthem; "AAAAAHHHHH!!!!"

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups