|
 |
asp_web_howto thread: If then else
Message #1 by "Oliver Dempsey" <odempsey@b...> on Fri, 15 Dec 2000 21:10:51 -0000
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0033_01C066DB.813CF2A0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
This code works fine but I was just wondering is there a tidier way to
process information from 6 submit buttons?
<%
Session("sellerID") =3D Request.Form("sellerID")
If Request.Form("AddProperty")<>"" then
Session("Action") =3D Request.Form("addproperty")
Response.Redirect "property.asp"
Else
If Request.Form("EditProperty")<>"" then
Session("Action") =3D Request.Form("editproperty")
Response.Redirect "property.asp"
Else
If Request.Form("DeleteProperty")<>"" then
Session("Action") =3D Request.Form("deleteproperty")
Response.Redirect "property.asp"
Else
If Request.Form("Addseller")<>"" then
Session("Action") =3D Request.Form("addseller")
Else
If Request.Form("editseller")<>"" then
Session("Action") =3D Request.Form("editseller")
Else
If Request.Form("deleteseller")<>"" then
Session("Action") =3D Request.Form("deleteseller")
end if
end if
end if
end if
end if
end if%>
Regards
Oliver Dempsey
---
MaximumASP offers enhanced hosting solutions on the Windows 2000 platform. Dedicated processor, RAM, and server resources provide
dedicated server performance at virtual server prices. Commercial components provided; custom components allowed.
---
You are currently subscribed to asp_web_howto as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #2 by "Craig Miller" <craigm@r...> on Fri, 15 Dec 2000 14:55:00 -0800
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0013_01C066A6.FF58FC40
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
This might be the same thing but wouldn't it be better to do:
<%
Session("sellerID") = Request.Form("sellerID")
If Request.Form("AddProperty")<>"" then
Session("Action") = Request.Form("addproperty")
Response.Redirect "property.asp"
Else If Request.Form("EditProperty")<>"" then
Session("Action") = Request.Form("editproperty")
Response.Redirect "property.asp"
Else If Request.Form("DeleteProperty")<>"" then
Session("Action") = Request.Form("deleteproperty")
Response.Redirect "property.asp"
Else If Request.Form("Addseller")<>"" then
Session("Action") = Request.Form("addseller")
Else If Request.Form("editseller")<>"" then
Session("Action") = Request.Form("editseller")
Else If Request.Form("deleteseller")<>"" then
Session("Action") = Request.Form("deleteseller")
End If%>
This might be exactly what you had before though,
Craig
-----Original Message-----
From: Oliver Dempsey [mailto:odempsey@b...]
Sent: Friday, December 15, 2000 1:11 PM
To: ASP Web HowTo
Subject: [asp_web_howto] If then else
This code works fine but I was just wondering is there a tidier way to
process information from 6 submit buttons?
<%
Session("sellerID") = Request.Form("sellerID")
If Request.Form("AddProperty")<>"" then
Session("Action") = Request.Form("addproperty")
Response.Redirect "property.asp"
Else
If Request.Form("EditProperty")<>"" then
Session("Action") = Request.Form("editproperty")
Response.Redirect "property.asp"
Else
If Request.Form("DeleteProperty")<>"" then
Session("Action") = Request.Form("deleteproperty")
Response.Redirect "property.asp"
Else
If Request.Form("Addseller")<>"" then
Session("Action") = Request.Form("addseller")
Else
If Request.Form("editseller")<>"" then
Session("Action") = Request.Form("editseller")
Else
If Request.Form("deleteseller")<>"" then
Session("Action") = Request.Form("deleteseller")
end if
end if
end if
end if
end if
end if%>
Regards
Oliver Dempsey
---
MaximumASP offers enhanced hosting solutions on the Windows 2000 platform.
Dedicated processor, RAM, and server resources provide dedicated server
performance at virtual server prices. Commercial components provided; custom
components allowed.
leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com
---
MaximumASP offers enhanced hosting solutions on the Windows 2000 platform. Dedicated processor, RAM, and server resources provide
dedicated server performance at virtual server prices. Commercial components provided; custom components allowed.
---
You are currently subscribed to asp_web_howto as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #3 by "Craig Miller" <craigm@r...> on Fri, 15 Dec 2000 14:59:19 -0800
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0017_01C066A7.99F02E40
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Sorry, I didn't read it closely the first time. One way of doing this would
be to give each button a unique ID (int) then you could build a case
statement.
Craig
-----Original Message-----
From: Oliver Dempsey [mailto:odempsey@b...]
Sent: Friday, December 15, 2000 1:11 PM
To: ASP Web HowTo
Subject: [asp_web_howto] If then else
This code works fine but I was just wondering is there a tidier way to
process information from 6 submit buttons?
<%
Session("sellerID") = Request.Form("sellerID")
If Request.Form("AddProperty")<>"" then
Session("Action") = Request.Form("addproperty")
Response.Redirect "property.asp"
Else
If Request.Form("EditProperty")<>"" then
Session("Action") = Request.Form("editproperty")
Response.Redirect "property.asp"
Else
If Request.Form("DeleteProperty")<>"" then
Session("Action") = Request.Form("deleteproperty")
Response.Redirect "property.asp"
Else
If Request.Form("Addseller")<>"" then
Session("Action") = Request.Form("addseller")
Else
If Request.Form("editseller")<>"" then
Session("Action") = Request.Form("editseller")
Else
If Request.Form("deleteseller")<>"" then
Session("Action") = Request.Form("deleteseller")
end if
end if
end if
end if
end if
end if%>
Regards
Oliver Dempsey
---
MaximumASP offers enhanced hosting solutions on the Windows 2000 platform.
Dedicated processor, RAM, and server resources provide dedicated server
performance at virtual server prices. Commercial components provided; custom
components allowed.
leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com
---
MaximumASP offers enhanced hosting solutions on the Windows 2000 platform. Dedicated processor, RAM, and server resources provide
dedicated server performance at virtual server prices. Commercial components provided; custom components allowed.
---
You are currently subscribed to asp_web_howto as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #4 by "Martin McIntyre" <martin@m...> on Fri, 15 Dec 2000 23:33:24 -0000
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0006_01C066EF.6ADC1900
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Just have an invisible field on your form, and populate that Client Side
with the 'Action' of each button. Then in sever side you only need to check
the one Form field.
e.g.
----- Client side (in Pseduo format)
sub SubmitBtn1_onclick()
formname.valAction.value = "AddP"
formname.submit
end sub
sub SubmitBtn1_onclick()
formname.valAction.value = "EditP"
formname.submit
end sub
sub SubmitBtn1_onclick()
formname.valAction.value = "DelP"
formname.submit
end sub
sub SubmitBtn1_onclick()
formname.valAction.value = "AddS"
formname.submit
end sub
sub SubmitBtn1_onclick()
formname.valAction.value = "EditS"
formname.submit
end sub
sub SubmitBtn1_onclick()
formname.valAction.value = "DelS"
formname.submit
end sub
------Then Server Side -----
<% Select Case Request.Form("valAction")
Case "AddP":
Response.Redirect "property.asp"
Case "EditP":
Response.Redirect "property.asp"
......
......
%>
AND SO ON
you get my drift.
Cheers
Martin
-----Original Messa
[Martin NTL] ge-----
From: Oliver Dempsey [mailto:odempsey@b...]
Sent: 15 December 2000 21:11
To: ASP Web HowTo
Subject: [asp_web_howto] If then else
This code works fine but I was just wondering is there a tidier way to
process information from 6 submit buttons?
<%
Session("sellerID") = Request.Form("sellerID")
If Request.Form("AddProperty")<>"" then
Session("Action") = Request.Form("addproperty")
Response.Redirect "property.asp"
Else
If Request.Form("EditProperty")<>"" then
Session("Action") = Request.Form("editproperty")
Response.Redirect "property.asp"
Else
If Request.Form("DeleteProperty")<>"" then
Session("Action") = Request.Form("deleteproperty")
Response.Redirect "property.asp"
Else
If Request.Form("Addseller")<>"" then
Session("Action") = Request.Form("addseller")
Else
If Request.Form("editseller")<>"" then
Session("Action") = Request.Form("editseller")
Else
If Request.Form("deleteseller")<>"" then
Session("Action") = Request.Form("deleteseller")
end if
end if
end if
end if
end if
end if%>
Regards
Oliver Dempsey
---
MaximumASP offers enhanced hosting solutions on the Windows 2000 platform.
Dedicated processor, RAM, and server resources provide dedicated server
performance at virtual server prices. Commercial components provided; custom
components allowed.
leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com
---
MaximumASP offers enhanced hosting solutions on the Windows 2000 platform. Dedicated processor, RAM, and server resources provide
dedicated server performance at virtual server prices. Commercial components provided; custom components allowed.
---
You are currently subscribed to asp_web_howto as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #5 by "Oliver Dempsey" <odempsey@b...> on Sat, 16 Dec 2000 11:34:53 -0000
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0028_01C06754.3555C0A0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
thanks for your suggestion Martin, I think I would have a preference for
Gary's idea,
it's excellent
I look forward to trying it out
Regards
Oliver
----- Original Message -----
From: Craig Miller
To: ASP Web HowTo
Sent: Friday, December 15, 2000 10:59 PM
Subject: [asp_web_howto] RE: If then else
Sorry, I didn't read it closely the first time. One way of doing this
would be to give each button a unique ID (int) then you could build a
case statement.
Craig
-----Original Message-----
From: Oliver Dempsey [mailto:odempsey@b...]
Sent: Friday, December 15, 2000 1:11 PM
To: ASP Web HowTo
Subject: [asp_web_howto] If then else
This code works fine but I was just wondering is there a tidier way
to process information from 6 submit buttons?
<%
Session("sellerID") =3D Request.Form("sellerID")
If Request.Form("AddProperty")<>"" then
Session("Action") =3D Request.Form("addproperty")
Response.Redirect "property.asp"
Else
If Request.Form("EditProperty")<>"" then
Session("Action") =3D Request.Form("editproperty")
Response.Redirect "property.asp"
Else
If Request.Form("DeleteProperty")<>"" then
Session("Action") =3D Request.Form("deleteproperty")
Response.Redirect "property.asp"
Else
If Request.Form("Addseller")<>"" then
Session("Action") =3D Request.Form("addseller")
Else
If Request.Form("editseller")<>"" then
Session("Action") =3D Request.Form("editseller")
Else
If Request.Form("deleteseller")<>"" then
Session("Action") =3D Request.Form("deleteseller")
end if
end if
end if
end if
end if
end if%>
Regards
Oliver Dempsey
---
MaximumASP offers enhanced hosting solutions on the Windows 2000
platform. Dedicated processor, RAM, and server resources provide
dedicated server performance at virtual server prices. Commercial
components provided; custom components allowed.
craigm@r...
leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com
---
MaximumASP offers enhanced hosting solutions on the Windows 2000
platform. Dedicated processor, RAM, and server resources provide
dedicated server performance at virtual server prices. Commercial
components provided; custom components allowed.
odempsey@b...
leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com
---
MaximumASP offers enhanced hosting solutions on the Windows 2000 platform. Dedicated processor, RAM, and server resources provide
dedicated server performance at virtual server prices. Commercial components provided; custom components allowed.
---
You are currently subscribed to asp_web_howto as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com
|
|
 |