Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Sub Procedures

Status
Not open for further replies.

mainmast

Programmer
Jun 26, 2003
176
US
Hello,

I'm new to ASP.NET, and I need some help.

In ASP, I could do the following:

<%
IF Request.QueryString("Blah") = "Blah" Then
ShowBlah
End IF
%>

HTML code...

<%
Sub ShowBlah
..
End Sub
%>



How would I do this in ASP.NET? Right now I have this:

Code:
<script runat="server">
	 Sub Page_Load(Sender As Object, E As EventArgs)
	  Dim SelectID AS Integer
		SelectID = Request.QueryString("ID")
		
		SELECT Case SelectID
		 Case 1 
		  ShowAbout()
		End SELECT
	 End Sub
	</script>

</head>
<body>
<% 
		 Sub ShowAbout()
		 Response.Write("Test")
		 End Sub
		 
		 %>
</body>
</html>

It gives me an error: Compiler Error Message: BC30289: Statement cannot appear within a method body. End of method assumed.


Thanks in advance!
 
<%@ Page Language="VB" %>
<script runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Dim SelectID AS Integer
SelectID = Request.QueryString("ID")

SELECT Case SelectID
Case 1
ShowAbout()
End SELECT
End Sub

Sub ShowAbout()
Label1.text= "Test"
End Sub

</script>
<html>
<head>
</head>
<body>
<asp:label id=Label1 runat=server />

</body>
</html>
 
I thought about doing that, but the Subs will include a lot of HTML, and some other .NET code.

How would I do that?
 
in classic ASP u have to include the SUB in the place where HTML requires to be outoputted (not necessarily). but in .NET that approach has changed. u have to create controls on the fly with the sub and input html into the controls...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top