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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP all in one page

Status
Not open for further replies.

mot98

MIS
Jan 25, 2002
647
0
0
CA
Hi all,

I am creating an ASP page, and I want it all on one page.
I have 3 functions, and I give the user a choice at the beginning of the page on what they want. Add, edit, or delete a record.

That list box is called varSelect. Can I use a function like this:

If varSelect=ADD Then
goto sub1
Else IF varSelect=EDIT
goto sub2
Else IF varSelect=DELETE
goto sub3
End IF


Is this allowed? And if so, do I have the syntax correct.

Thanks for any help.
mot98..[peace]

"Where's the beer?"
 
Try something like this..................
Hope this helps.........

<html>
<head>
<title>Untitled</title>
</head>
<body>
<form action=&quot;caseSelection.asp&quot; method=&quot;post&quot;>
<input type=&quot;radio&quot; name=&quot;caseSelection&quot; value=&quot;ADD&quot;>Add<br>
<input type=&quot;radio&quot; name=&quot;caseSelection&quot; value=&quot;EDIT&quot;>Edit<br>
<input type=&quot;radio&quot; name=&quot;caseSelection&quot; value=&quot;DELETE&quot;>Delete<br>
<input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Submit&quot;>
</form>

<%
Dim GotoCaseSelection
GotoSelection = Request.Form(&quot;caseSelection&quot;)

If GotoSelection = &quot;ADD&quot; Then
Response.Redirect &quot;ElseIf GotoSelection = &quot;EDIT&quot; Then
Response.Redirect &quot;ElseIf GotoSelection = &quot;DELETE&quot; Then
Response.Redirect &quot;delete.asp&quot;
End If

%>

</body>
</html>
 
Try this for syntax:

varSelect = Request.form(&quot;varSelect&quot;)

If varSelect=&quot;ADD&quot; Then
Call sub1
Else IF varSelect=&quot;EDIT&quot; Then
Call sub2
Else IF varSelect=&quot;DELETE&quot; Then
Call sub3
End IF
 
i typically design a page to encapsulate all the maintenance of one thing - typically a table/linktable.
normally i perform any add/modify/delete completion actions first, like:
dim str_Action
str_Action = Request.Form(&quot;Action&quot;)
select case str_Action
case &quot;completeadd&quot;
'call to add proc
case &quot;completemodify&quot;
'..so on.. (after attempting a add, etc it either sets
'str_Action to &quot;add&quot;,etc (goes back cos they got something wrong) or some default value (typically the page name) which indicates later on to list the records)
end select
Then I do any add/mod/del data gathering (same as above, but &quot;add&quot;, &quot;modify&quot;, &quot;delete&quot;)
Then eventually I list the records, if necessary. codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
<insert witticism here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top