ASP.Net/Development/Include inc file
Include inc file Demo
<%@ Page Language=VB Debug=true %>
<script runat=server>
Sub SubmitBtn_Click(Sender As Object, E As EventArgs)
lblResult.Text = MakeLength(txtStringToSize.Text, _
txtPadCharacter.Text, txtLength.Text)
End Sub
</SCRIPT>
<!-- #include file="makelength.inc" -->
<HTML>
<HEAD>
<TITLE>Make Length Sample Page</TITLE>
</HEAD>
<BODY TEXT="black" LINK="darkred" VLINK="darkred" ALINK="red" LEFTMARGIN="40" TOPMARGIN="60">
<form runat="server">
<Font Face="Tahoma" >
<asp:Label
id="lbl1"
runat="Server"
font-bold="True"
text="Enter String to Size"
/>
<BR>
<asp:TextBox
id="txtStringToSize"
runat="server"
/>
<BR><BR>
<asp:Label
id="lbl2"
runat="Server"
font-bold="True"
text="Enter Pad Character"
/>
<BR>
<asp:TextBox
id="txtPadCharacter"
runat="server"
/>
<BR><BR>
<asp:Label
id="lbl3"
runat="Server"
font-bold="True"
text="Enter Length"
/>
<BR>
<asp:TextBox
id="txtLength"
runat="server"
/>
<BR><BR>
<asp:button
id="butGo"
text=" Go "
Type="Submit"
runat="server"
OnClick="SubmitBtn_Click"
/>
<BR><BR>
<asp:Label
id="lblResult"
runat="Server"
font-bold="True"
/>
</Font>
</Form>
</BODY>
</HTML>
Linking to an Include Code Library
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
lblMessage1.Text = MakeLength("www.", "nfex.ru", 12)
lblMessage2.Text = SystemInfo()
End Sub
</SCRIPT>
<!-- #include file="CodeLibrary.inc" -->
<HTML>
<HEAD>
<TITLE>Linking to an Include Code Library</TITLE>
</HEAD>
<form runat="server">
<BR><BR>
<asp:label
id="lblMessage1"
runat="Server"
/>
<BR><BR>
<asp:label
id="lblMessage2"
runat="Server"
/>
<BR><BR>
</form>
</BODY>
</HTML>
<%--
<script runat=server>
Function MakeLength(StringToSize as String,PadCharacter as String, SizeToLength as Integer)
If Len(StringToSize) >= SizeToLength Then
MakeLength = Left(StringToSize, SizeToLength)
Else
MakeLength = StringToSize
Do Until Len(MakeLength) = SizeToLength
MakeLength = MakeLength & PadCharacter
Loop
End If
End Function
Public Function SystemInfo()
SystemInfo = "Machine Name: " & Server.MachineName _
& "<BR>Current Script Timeout: " _
& Server.ScriptTimeOut _
& " seconds<BR>Path to Page: " _
& Server.MapPath("") & "<BR>System Date/Time: " _
& Date.Now()
End Function
</script>
--%>