We started re-coding the Components Section using ASP.NET. Being new to the various techniques of inserting records, returning data to a form with ASP.NET. We decided to use a technique called "Code-Behind Web Forms" and like so many other things about ASP.NET….we loved it!. This allows up to put our Business logic into a separate file.
This technique allows for true separation of the HTML
code and Business Logic. The HTML is on one aspx page and the business logic is
stored in its own file away from trouble! All that is required at
the top of your aspx page is one line! One attribute uses the Inherits
directive (This tells which function to use) and src(where the .vb
or .cs file reside). For this example
<%@ 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 followingComponent1a.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" |