473,734 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic case statement

Tom
I would like to know if an .asp case statement can contain HTML elements. I
am building an application that I would like to have dynamic choices. The
dynamic part would be built in the a case statment that will output based
upon the value of the option evaluated. This example only shows one case
statement but there are eight case statements.
Thanks for any insight!
Tom
If Not objRs.EOF Then
Do While Not objRs.EOF

Select Case mvar
Case 2
<TABLE BORDER=0 WIDTH=700;">
<TR>
<TD align="left" vAlign="top" WIDTH="50%" colSpan=2>Extra Comments</TD>
<TD align="left" vAlign="top" WIDTH="50%" colSpan=2>Inclu de in Month
End Report</TD>
</TR>
<TR>
<TD align="left" vAlign="top" WIDTH="50%" colSpan=2>
<INPUT type=text value=1 name=test1></TD>
<TD align="left" vAlign="top" WIDTH="50%" colSpan=2>
<INPUT TYPE="RADIO" NAME="test2" VALUE="IncludeM onthEnd" /></TD>
</TR>
</TABLE>

<!--> Missing record processing in each case statement and the balance of
the eight case statements -->
objRs.MoveNext
Loop
End If
Jul 19 '05 #1
2 2367
<%
mvar = request.queryst ring("mvar")
If mvar = 2 then
%>
<table border=1><tr><t d><font color=blue>Some
text</font></td></tr></table>
<%
elseif mvar = 1 then
%>
<table border=1><tr><t d><font color=red>Some
text</font></td></tr></table>
<%
else
%>
<table border=1><tr><t d><font color=green>Som e
text</font></td></tr></table>
<%
end if
%>
--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Tom <to*********@ab ercrombienospam kent.com> wrote in message
news:OE******** *****@TK2MSFTNG P11.phx.gbl...
I would like to know if an .asp case statement can contain HTML elements. I am building an application that I would like to have dynamic choices. The
dynamic part would be built in the a case statment that will output based
upon the value of the option evaluated. This example only shows one case
statement but there are eight case statements.
Thanks for any insight!
Tom
If Not objRs.EOF Then
Do While Not objRs.EOF

Select Case mvar
Case 2
<TABLE BORDER=0 WIDTH=700;">
<TR>
<TD align="left" vAlign="top" WIDTH="50%" colSpan=2>Extra Comments</TD> <TD align="left" vAlign="top" WIDTH="50%" colSpan=2>Inclu de in Month
End Report</TD>
</TR>
<TR>
<TD align="left" vAlign="top" WIDTH="50%" colSpan=2>
<INPUT type=text value=1 name=test1></TD>
<TD align="left" vAlign="top" WIDTH="50%" colSpan=2>
<INPUT TYPE="RADIO" NAME="test2" VALUE="IncludeM onthEnd" /></TD>
</TR>
</TABLE>

<!--> Missing record processing in each case statement and the balance of
the eight case statements -->
objRs.MoveNext
Loop
End If

Jul 19 '05 #2
Tom wrote:
I would like to know if an .asp case statement can contain HTML
elements. I am building an application that I would like to have
dynamic choices. The dynamic part would be built in the a case
statment that will output based upon the value of the option
evaluated. This example only shows one case statement but there are
eight case statements.
Thanks for any insight!
Tom

You either have to response.write the html strings, or end the server-side
script blocks at the appropriate locations:

either
select case mvar
Case 2
Response.write "<TABLE BORDER=0 WIDTH=700>"
etc.

or
select case mvar
Case 2
%>
<TABLE BORDER=0 WIDTH=700;">
<TR>
<TD align="left" vAlign="top" WIDTH="50%" colSpan=2>Extra Comments</TD>
<TD align="left" vAlign="top" WIDTH="50%" colSpan=2>Inclu de in Month
End Report</TD>
</TR>
<TR>
<TD align="left" vAlign="top" WIDTH="50%" colSpan=2>
<INPUT type=text value=1 name=test1></TD>
<TD align="left" vAlign="top" WIDTH="50%" colSpan=2>
<INPUT TYPE="RADIO" NAME="test2" VALUE="IncludeM onthEnd" /></TD>
</TR>
</TABLE>
<%
Case 3
%>
etc.

HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1891
by: Roel Wuyts | last post by:
CALL FOR CONTRIBUTIONS International Workshop on Revival of Dynamic Languages http://pico.vub.ac.be/~wdmeuter/RDL04/index.html (at OOPSLA2004, Vancouver, British Columbia, Canada, October 24-28, 200) Organization committee: Roel Wuyts (primary contact - roel.wuyts@ulb.ac.be), Gilad Bracha, Wolfgang De Meuter, Stéphane Ducasse and Oscar Nierstrasz.
2
1470
by: Richard | last post by:
Hi all, I had a stored procedure that i wanted to be able to pass parameters to so i used dynamic SQL. I am getting very strange errors though when i try to execute it. My code works just fine, but when i add the dynamic sql parts in, it gives the strangest errors. Here is the code that executes it... Declare @data_source varchar(50)
9
14889
by: mooseshoes | last post by:
All: I'm using Access 2000 on a Windows XP platform. My goal is to use a form to gather user criteria which I will then parse into a useable SQL string. At this point I would like to open one or more reports and use the query as the recordsource. What would be a common approach to doing this? I have been using ADO methods up until this point for other tasks.
4
2201
by: Zark3 | last post by:
Hi all, I was wondering if anybody could enlighten me on the possibility of dynamic casting. Or, well, whether or not I'm actually trying to do this the right way. What I have is a base class that several classes inherit from. From time to time I need to add new inherited types so I want something that is as versatile as possible, preferably not requiring naming all subtypes in a switch statement.
1
6279
by: letmatros | last post by:
Hi, I have a fairly simple select statement, but I want to do pagination and the sort order should be controlled by the user. The last part is causing me problems... I use DB2 8.2.3 on Windows. My idea is to create a prepared statement (or a named query) instead of using dynamic SQL. SELECT * FROM (SELECT ROWNUMBER() OVER( ORDER BY CASE CAST(? AS SMALLINT) WHEN 1 THEN a.firstname WHEN 2 THEN a.lastname WHEN 3 THEN a.workphone WHEN 4...
1
8432
by: Pacific Fox | last post by:
Hi all, I have a SQL statement that allows paging and dynamic sorting of the columns, but what I can't figure out without making the SQL a dynamic string and executing it, or duplicating the SQL statement between an IF and ELSE statement. Following is the SQL statement; set ANSI_NULLS ON
3
18715
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however, working with complex reports is tricky Assumption: Reader of this article have basic knowledge of creating data reports. Creating a Parent-Child Command and create a DataReport Suppose we have a database called company with two tables ...
6
7973
by: =?ISO-8859-1?Q?Tim_B=FCthe?= | last post by:
Hi, we are building a Java webapplication using JSF, running on websphere, querying a DB2 9 on Suse Enterprise 10. The app uses JDBC and PreparedStatements only (aka dynamic SQL). Every night, there is a ETL which deletes most of the data in the database and fills it all new. We observed very bad performance for some statements that ran for minutes (The queried table is about 100,000 records and the result is about 500 rows)....
2
8957
by: Damir | last post by:
Hello! I have noticed that after (sucessfully) executing the command: FLUSH PACKAGE CACHE DYNAMIC the dynamic SQL statement cache is not completely cleared (some of the dynamic SQL statement elements are not reset). For example, looking at the dynamic SQL snapshot I see a certain SQL statement that has been executed a number of times and has read a (big) number of rows. Then I execute the "FLUSH PACKAGE CACHE DYNAMIC" command.
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8776
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9182
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.