Code Separation <%@ Page inherits= "MyCodeBehind" src= "C2.vb"%>
There is a nice section of the QuickStart docs on this topic also. Click here to read up on it!
This is the code
This example uses the following
Ms-sql Server 7.0 Database
Stored Procedure
Component1a.aspx (HTML File)
C2.vb
Component1a.aspx (The Page is the UI)
<%@ Page inherits= "MyCodeBehind" src= "C2.vb" debug= "true" trace= "true"%>
<script language= "VB" runat= "Server" >
Sub Page_Load (Sender as Object, E as EventArgs)
Response.Write ("SMILE!!! I Love learning new Things Everyday ")
End Sub
</script>
<title>component Page 1</title>
<body>
<table border=0 cellpadding=3 cellspacing=3>
<tr bgcolor= "#CCCCCC" >
<td>
<font face= "Arial, Helv" size= "-1" >
Please fill out the form to create a new user profile for your
Company ' s Component.
<br>
Once This information are gathered you won't need to enter it again and you are able to update anytime.
<p>
Use the button in the bottom of this page to continue when you are finished.
<br>
</font>
</td>
</tr>
</table>
<font size= "+1" ><b><font color= "#ff0000" >*=required fields</b><br>
<form method= "Post" Name= "Form1" runat= "Server" >
<table> <tr>
<TD align=right>
<asp:label id= "Label1" text= "Company Name" Font-name= "Verdana" font-size= "10pt" width= "200px" borderstyle= "solid" Bordercolor= "#cccccc" runat= "Server"/>
</td>
<td>
<asp:textbox id= "CompanyName" size= runat= "Server"/>
<asp:requiredfieldvalidator controltovalidate= "CompanyName" display= "Dynamic" errormessage= "You must enter your name! "runat=server/>
</td>
</tr>
<tr>
<TD align=right>
<asp:label id= "Label2" text= "Company URL" Font-name= "Verdana" font-size= "10pt" width= "200px" borderstyle= "solid" Bordercolor= "#cccccc" runat= "Server"/>
</td>
<td>
<asp:textbox id= "Companyurl" size= runat= "Server"/>
</td>
</tr>
</font>
<tr>
<TD align=right>
<asp:label id= "Label3" text= "Contact Email" font-name= "Verdana" font-size= "10pt" width= "200px" borderstyle= "solid" Bordercolor= "#cccccc" runat= "Server"/>
</td>
<td>
<asp:textbox id= "EmailAddress" size= "runat=" "Server" maintainstate= "false"/>
<asp:regularexpressionvalidator controltovalidate= "EmailAddress" validationexpression= "[\w-]+@[\w-]+\. (com|net|org|edu|mil) "display=" Dynamic "font-name=" Verdana "font-size=" 9pt "errormessage=" must use a valid email Address. "runat=" Server > </asp:RegularExpressionValidator>
<asp:requiredfieldvalidator controltovalidate= "EmailAddress" display= "dynamic" font-name= "Verdana" 9pt "errormessage=" ' Email ' must not being left blank. "Runat=server> </asp:RequiredFieldValidator> </td>
</tr>
</table>
<table border=0 bgcolor= "#CCCCCC" cellpadding=3 cellspacing=3 width= "490" >
<tr>
<TD width= "100%" colspan= "2" >
<asp:button id= "Button1" text= "Create profile" onclick= "Button1_Click" runat= "Server"/>
</td>
</tr>
</table>
</form>
</body>
C2.vb file (this file Contains the business logic which is inherited just like a compiled DLL
Option Strict off
Imports System
Imports System.DateTime
Imports System.Globalization
Imports System.Data
Imports System.Data.SQL
Imports System.Web.UI
Imp