By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,616 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

I cannot access class inside ASP.NET Web Application !

P: 15
I cannot access class inside ASP.NET Web Application
a few seconds ago|LINK

Hello,

I start to created a new ASP.NET Web Application with VS 2005.

I created a sperate folder called "Classes" where I created my first class "CContact".

Then, I added a page "default.aspx" in order to display First name & Last name.

Unfortunately, I cannot access the class "CContact in the Page_Load() method when I try to type the following code: MyWebApp. ... The only class that i can see is "_Default"

What i'm doing wrong ?

Can anyone help me ?

Thank you

Paul


Expand|Select|Wrap|Line Numbers
  1. // -----------------------------------------------------------
  2. // Class: CContact.cs
  3. // -----------------------------------------------------------
  4. using System;
  5. using System.Data;
  6. using System.Configuration;
  7. using System.Web;
  8. using System.Web.Security;
  9. using System.Web.UI;
  10. using System.Web.UI.WebControls;
  11. using System.Web.UI.WebControls.WebParts;
  12. using System.Web.UI.HtmlControls;
  13.  
  14. namespace MyWebApp
  15. {
  16.     public class CContact
  17.     {
  18.  
  19.         // Constructor
  20.         public CContact()
  21.         {
  22.  
  23.         }
  24.  
  25.         public static string FirstName()
  26.         {
  27.             return "John";
  28.         }
  29.  
  30.         public static string LastName()
  31.         {
  32.             return "Travolta";
  33.         }
  34.  
  35.     }
  36. }
  37.  
  38.  
  39.  
  40. // -----------------------------------------------------------
  41. // ASP.Net Page: default.aspx.cs
  42. // -----------------------------------------------------------
  43. using System;
  44. using System.Data;
  45. using System.Configuration;
  46. using System.Collections;
  47. using System.Web;
  48. using System.Web.Security;
  49. using System.Web.UI;
  50. using System.Web.UI.WebControls;
  51. using System.Web.UI.WebControls.WebParts;
  52. using System.Web.UI.HtmlControls;
  53.  
  54. using MyWebApp;
  55.  
  56. namespace MyWebApp
  57. {
  58.     public partial class _Default : System.Web.UI.Page
  59.     {
  60.         protected void Page_Load(object sender, EventArgs e)
  61.         {
  62.  
  63.         }
  64.     }
  65. }
  66.  
Mar 7 '12 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.