J
JH
I'm new in the .NET world, so sorry if this is a faq. In classic ASP I
often use a include file with some standard functions, ex. formating a
string an so. How do a do this i .NET ??
In my test code below, I submit a form with a textbox, use the
function "format_string" to change the value. I would like to use this
function in other scripts also, so need to place the code in another
file, and include it, how ?
I'll appreciate if someone could change my test code, to show me the
right way to do it.
Thx..
test.aspx
------------------
<%@ page language="vb" inherits="test" src="test.vb" %>
<html>
<head>
</head>
<body>
<form id="test" method="post" runat="server">
<asp:textbox id="sometext" text="" runat="server" />
<asp:button id="submit" text="submit" onclick="test_me"
runat="server" />
</form>
</body>
</html>
------------------
test.vb
------------------
Imports System
Imports System.Web.UI
public class test : inherits page
sub test_me(ByVal Sender As Object, ByVal E As EventArgs)
dim sometext as string
sometext = format_string(Request.Form("sometext"))
end sub
function format_string(value as string) as string
return "!" & value & "!"
end function
end class
------------------
often use a include file with some standard functions, ex. formating a
string an so. How do a do this i .NET ??
In my test code below, I submit a form with a textbox, use the
function "format_string" to change the value. I would like to use this
function in other scripts also, so need to place the code in another
file, and include it, how ?
I'll appreciate if someone could change my test code, to show me the
right way to do it.
Thx..
test.aspx
------------------
<%@ page language="vb" inherits="test" src="test.vb" %>
<html>
<head>
</head>
<body>
<form id="test" method="post" runat="server">
<asp:textbox id="sometext" text="" runat="server" />
<asp:button id="submit" text="submit" onclick="test_me"
runat="server" />
</form>
</body>
</html>
------------------
test.vb
------------------
Imports System
Imports System.Web.UI
public class test : inherits page
sub test_me(ByVal Sender As Object, ByVal E As EventArgs)
dim sometext as string
sometext = format_string(Request.Form("sometext"))
end sub
function format_string(value as string) as string
return "!" & value & "!"
end function
end class
------------------