日期:2012-11-01  浏览次数:21040 次

<%@ Page Inherits="MyCodeBehind" Src="c2.vb" %>

There is a nice section in the quickstart docs on this topic also. Click here to read up on it!

Here 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 that 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>


<html>
<head>
<title>Component Page 1</title>
</head>
<body>
<table border=0 cellpadding=3 cellspacing=3>
<tr bgcolor="#CCCCCC">
<td>
<font face="Arial, Helv" size="-1">
Please fill out this form to create a new user profile for your
Company's Component.
<br>
Once this information is gathered you will not need to enter it again and you will be able to update anytime.
<p>
Use the button at 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="30" 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="30" 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="30" 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" Font-Size="9pt" ErrorMessage="'Email' must not be left blank." runat=server> </asp:RequiredFieldValidator> </td>
</tr>
</table>

<table border=0 bgcolor="#CCCCCC&quo