Ask a Question related to Macromedia Dreamweaver, Design and Development.
-
stewboy webforumsuser@macromedia.com #1
How to display alternate text based on dynamic data?
I need to display alternate text based on returns from a record set.
For example, when my recordset returns "21," which is a code for an employee type, I want to display "Welder" rather than "21". When the return is "20" I want to display "steamfitter" rather than "20".
Those two numbers are the only two codes I have to deal with, so the scope of the challenge is small. Unfortunately "welder" and "steamfitter" don't exist in the database, and I can't change it to include them.
stewboy webforumsuser@macromedia.com Guest
-
Dynamic control creation in datagrid based on data in that column
I am creating a dynamic datagrid. The controls in some of the template columns will have to be generated based on the data contained in them (i.e.... -
Asp.net2 Menu control dynamic display based on User Role!!!Help please!!!
Hi I want to create a horizontal menu on my website being built using asp.net2 with menu items based on the "role" of the user who logged into the... -
how to display dynamic data in groups
Hello, I'm trying to create a 3 column table with grouping. In the database, I have a table where I'm extracting two fields Index, and Name. The... -
display text field based on the selection choices
I want to display credit card fields when the user selects the option paid membership. If user selects the option free membership, then the credit... -
Dynamic List based on form field data
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.500 / Virus Database: 298 -... -
stewboy webforumsuser@macromedia.com #2
Re:How to display alternate text based on dynamic data?
Here's some code I'm trying but failing with. How close am I?
<%
If (SiteEmps.Fields.Item("EMP_CODE").Value = "20)" THEN
<p align="center"><font color="#000000" size="+2" face="Arial, Helvetica, sans-serif">
Steamfitters</font></p>)
End If
%>
<%
If (SiteEmps.Fields.Item("EMP_CODE").Value = "21)" THEN
<p align="center"><font color="#000000" size="+2" face="Arial, Helvetica, sans-serif">
Welders</font></p>)
End If
%>
stewboy webforumsuser@macromedia.com Guest
-
Joe {RoastHorse} #3
Re: Re:How to display alternate text based on dynamic data?
your quotes are in the wrong place:
Value = "20)"
Value = "21)"
should be:
Value = "20")
Value = "21")
follow david's example - no need to duplicate that html.
joe
"stewboy" <webforumsuser@macromedia.com> wrote in message
news:bfov0p$pr3$1@forums.macromedia.com...sans-serif">> Here's some code I'm trying but failing with. How close am I?
>
> <%
> If (SiteEmps.Fields.Item("EMP_CODE").Value = "20)" THEN
> <p align="center"><font color="#000000" size="+2" face="Arial, Helvetica,sans-serif">> Steamfitters</font></p>)
> End If
> %>
> <%
> If (SiteEmps.Fields.Item("EMP_CODE").Value = "21)" THEN
> <p align="center"><font color="#000000" size="+2" face="Arial, Helvetica,> Welders</font></p>)
> End If
> %>
>
>
>
Joe {RoastHorse} Guest
-
Gary White #4
Re: How to display alternate text based on dynamic data?
On Thu, 24 Jul 2003 10:40:33 -0500, "David R. Wheeler"
<dont-want@no.spam> wrote:
Might be easier, or more intuitive, if you use a select case statement>myField = (rsName.Fields.Item("column").Value)
>If myField = "20" Then
> jobTitle = "steamfitter"
>Else
> jobTitle = "Welder"
>End If
because you KNOW, as time goes on, there will be more codes:
myField = SiteEmps.Fields.Item("EMP_CODE").Value
Select Case myField
Case "20" jobTitle = "steamfitter"
Case "21" jobTitle = "welder"
Case Else jobTitle = "unknown"
End Select
Now, if you get another, it's quick and easy to add it.
All that said, you should think about the future when, one day, you'll
decide to place the job titles in a table.
Gary
Gary White Guest
-
David R. Wheeler #5
Re: How to display alternate text based on dynamic data?
> Might be easier, or more intuitive, if you use a select case statement
because you KNOW, as time goes on, there will be more codes:
Very true, but I'm only on my 2nd pot of coffee and not quite thinking ahead yet! :)
--
Dave
-----------------------------------------------------------------
If I were half as smart as people think I am...
I'd be twice as smart as I was before I forgot everything.
(Official victim of CRAFT Syndrome)
=======================
David R. Wheeler Guest
-
Paul Taylor #6
Re: How to display alternate text based on dynamic data?
Try this>>
>>"stewboy" <webforumsuser@macromedia.com> wrote in message
>>news:bfov0p$pr3$1@forums.macromedia.com...>>sans-serif">>>> Here's some code I'm trying but failing with. How close am I?
>>>
>>> <%
>>> If (SiteEmps.Fields.Item("EMP_CODE").Value = "20)" THEN
>>> <p align="center"><font color="#000000" size="+2" face="Arial, Helvetica,>>sans-serif">>>> Steamfitters</font></p>)
>>> End If
>>> %>
>>> <%
>>> If (SiteEmps.Fields.Item("EMP_CODE").Value = "21)" THEN
>>> <p align="center"><font color="#000000" size="+2" face="Arial, Helvetica,>>>>> Welders</font></p>)
>>> End If
>>> %>
>>>
>>>
>>>
<%
if (CInt(SiteEmps.Fields.Item("EMP_CODE").Value) = 20) then
%>
<p style="text-align:center; color:#000000; font-size:14pt;
font-family:Arial, Helvetica,sans-serif">Steamfitters</p>
<% else if (CInt(SiteEmps.Fields.Item("EMP_CODE").Value) = 21) then
%>
<p style="text-align:center; color:#000000; font-size:14pt;
font-family:Arial, Helvetica,sans-serif">Welders</p>
<%
end if
%>
I have corrected the html, because the font tag is deprecated and
should not be used. I have put inline style in for you, though it
would in fact be better in an external stylesheet.
Note the use of the CInt function to make sure that the read field is
interpreted as a number, which can be compared with the numbers you
require.
Paul Taylor
Paul Taylor Guest



Reply With Quote

