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
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
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 // } }
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.
Bookmarks