Results 1 to 3 of 3

Thread: How to add class.cs files to ASP.NET project

  1. #1
    Join Date
    Feb 2009
    Posts
    79

    How to add class.cs files to ASP.NET project

    Hello,

    I am able to create the Class.cs file in the VB.net but i am confused whether in the ASP also there is the same procedure to do it, so please let me know if there would be any changes.

    Regards

  2. #2
    Join Date
    Dec 2008
    Posts
    183

    Re: How to add class.cs files to ASP.NET project

    The class file that adds into the project will have some essential namespaces included into it along with a default constructor. For demonstration, we are going to create a class file for Customer database manipulation, so let us create a Class File named as CustomerCls.cs. The columns in the Customer Table is Customer Code [Cus_Code] which is primary and identity column, Customer Name [Cus_Name], Gender[Cus_Gender], City[Cus_City], State[Cus_State], Customer Type [Cus_Type]. So the basic code of the CustomerCls.cs structure will be as follows

    Code:
    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    
    ///
    /// Summary description for CustomerCls
    ///
    
    public class CustomerCls
    {
      public CustomerCls() 
      { 
        // 
        // TODO: Add constructor logic here 
        // 
      }
    }

  3. #3
    Join Date
    Dec 2008
    Posts
    161

    Re: How to add class.cs files to ASP.NET project

    What I was referring to was to develop the "codebehind" classes in a class library project and compile into a DLL. Then this DLL is referenced in the web project, which has its own DLL. The web project would largely consists of the aspx/ascx files. The web project compiles into a small DLL (pretty much global.asax.cs). The classes in the first DLL are used in the aspx by registering like this:

    <%@ Register TagPrefix="AspNetForums" Namespace="AspNetForums.Controls" Assembly="AspNetForums" %>
    .........
    <AspNetForums:LoginProcessor id="abc123" runat="server" />
    .........

    What I want to know is if I go with this kind of code separation, how do I add an aspx or ascx without the VS.NET automatically sticks an aspx.cs/ascx.cs file for me, as I don't need the cs files in the web project itse lf, they are defined in the class library project.

Similar Threads

  1. Suggest topic for Physics Project for Class XII
    By Tahseen Shahzad in forum Education Career and Job Discussions
    Replies: 3
    Last Post: 18-08-2014, 06:30 PM
  2. Replies: 4
    Last Post: 26-03-2012, 06:42 PM
  3. Inserting files into a master project
    By shoppingboy in forum Microsoft Project
    Replies: 9
    Last Post: 19-10-2011, 07:21 PM
  4. Read MS Project files from C#
    By shyjo in forum Software Development
    Replies: 6
    Last Post: 16-07-2011, 04:06 PM
  5. Java Source Code From Compiled Binary CLASS Files
    By Layton in forum Windows Software
    Replies: 4
    Last Post: 20-03-2010, 08:54 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,047,055.57664 seconds with 17 queries