Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 17th, 2004, 02:16 PM
Authorized User
 
Join Date: Feb 2004
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default 'OR' Expression

Hello.

How do I get an expression that evaluates a value like this:
If the drop down list's selected value is 1 or 3 or 4, do this. Otherwise do this.

I have tried both:

If ddlCollType.SelectedItem.Value = "1" OR "3" OR "4" Then
ETC.
Else
ETC...
End If

and:

If ddlCollType.SelectedItem.Value = "1|3|4" Then
ETC.
Else
ETC...
End If

but neither works. What is the proper syntax? Thanks.

 
Old February 17th, 2004, 02:34 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The problem is that OR is an operator that takes two boolean arguments and returns returns one.

So in your case, the 1 OR 3 OR 4 part really executes as two separate subexpressions:
Code:
   (1 OR 3)
    \____/
       |
     (result)  OR 4)
What you need to do is something more like this:

if ddlCollType.SelectedItem.Value = 1 OR
   ddlCollType.SelectedItem.Value = 3 OR
   ddlCollType.SelectedItem.Value = 4 Then

   Etc.

Else
   Etc.

End If

You might also want to look at select statements.


Take care,

Nik
http://www.bigaction.org/
 
Old February 17th, 2004, 03:03 PM
Authorized User
 
Join Date: Feb 2004
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nick -

I set up a Select statement. Thanks.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Message> in query expression <expression>. (Error ybg1 Access 5 July 15th, 2007 05:42 AM
sort by expression ronisc XSLT 1 December 17th, 2006 02:36 PM
Validator expression Maxxim ASP.NET 1.0 and 1.1 Professional 1 December 3rd, 2006 07:07 AM
Regular expression C# radhakrishnan1976 General .NET 1 February 19th, 2006 01:11 AM
Regular Expression DARSIN General .NET 2 November 9th, 2004 08:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.