locked
The type or namespace name 'Client' could not be found (are you missing a using directive or an assembly reference?) RRS feed

  • Question

  • Hi all,

        I have error  "The type or namespace name 'Client' could not be found (are you missing a using directive or an assembly reference?) "

    I have Client.ascx.cs page

    Client newPanel = (Client)LoadControl(

    "Client.ascx");

     

    Sunday, March 21, 2010 4:54 AM

Answers

  • You need a using statement at the top of your class, specifying the complete namespace of the project where your class is defined:

    using My.Name.Space;

    Alternatively, you could instantiate it with the fully qualified namespace and leave out the using statement.

    My.Name.Space.Client newPanel = (My.Name.Space.Client)LoadControl("Client.ascx");

    I don't know if you need the fully qualified namespace in the LoadControl parameter, but you probably do need it there too.


    ~~Bonnie Berent [C# MVP]

    geek-goddess-bonnie.blogspot.com
    • Marked as answer by Rawad Ebn MaM Tuesday, March 23, 2010 5:12 AM
    Sunday, March 21, 2010 5:15 AM

All replies

  • You need a using statement at the top of your class, specifying the complete namespace of the project where your class is defined:

    using My.Name.Space;

    Alternatively, you could instantiate it with the fully qualified namespace and leave out the using statement.

    My.Name.Space.Client newPanel = (My.Name.Space.Client)LoadControl("Client.ascx");

    I don't know if you need the fully qualified namespace in the LoadControl parameter, but you probably do need it there too.


    ~~Bonnie Berent [C# MVP]

    geek-goddess-bonnie.blogspot.com
    • Marked as answer by Rawad Ebn MaM Tuesday, March 23, 2010 5:12 AM
    Sunday, March 21, 2010 5:15 AM
  • Thank you for your reply , I solved my problem I found that there is error on
    public partial class Messenger : System.Web.UI.UserControl

     

     

    I have to write this

    public partial class Messenger : System.Web.UI.UserControl

     

     

     

    I don't know if this make sentence or not but after I change this the error is disappear.

    Thank you

     

    Sunday, March 21, 2010 5:26 AM
  • Looks the same to me ...
    ~~Bonnie Berent [C# MVP]

    geek-goddess-bonnie.blogspot.com
    Sunday, March 21, 2010 1:42 PM