Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 06-03-2009
Member
 
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
Reply With Quote
  #2  
Old 06-03-2009
Member
 
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 
    // 
  }
}
Reply With Quote
  #3  
Old 06-03-2009
Member
 
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to add class.cs files to ASP.NET project"
Thread Thread Starter Forum Replies Last Post
Suggest topic for Physics Project for Class XII Tahseen Shahzad Education Career and Job Discussions 3 18-08-2014 06:30 PM
How to Migrate .mpp files from Project 2003 to Project 2010 Skylar Microsoft Project 4 26-03-2012 06:42 PM
Inserting files into a master project shoppingboy Microsoft Project 9 19-10-2011 07:21 PM
Read MS Project files from C# shyjo Software Development 6 16-07-2011 04:06 PM
Java Source Code From Compiled Binary CLASS Files Layton Windows Software 4 20-03-2010 08:54 PM


All times are GMT +5.5. The time now is 07:50 AM.