|
 |
asp_databases thread: List Box selected won't work
Message #1 by "Oliver Dempsey" <odempsey@b...> on Tue, 19 Dec 2000 17:05:37 -0000
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_000C_01C069DD.E8A21880
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I am trying to have the current seller selected in a list box but it
won't work.
I cannot for the life of me figure out why this won't work. There is no
error message but it isn't selecting any of the sellers for me
eventhough I've checked it out and session("sellerID") is always equal
to one of the (rsSellers.Fields.Item("SellerID").Value) 's.
I've embolded the key part of the code for your interest
<select name=3D"select">
<% 'List all Sellers in the sellers table If user
is editing property then select the owner of the property
While (NOT rsSellers.EOF)
%>
<option value=3D"<%=3D(rsSellers.Fields.Item("SellerID").Value)%>"<%if
(rsSellers.Fields.Item("SellerID").Value) =3D session("sellerID") then
Response.Write
"selected"%>><%=3D(rsSellers.Fields.Item("LastName").Value)&",
"&(rsSellers.Fields.Item("FirstName").Value)&",
"&(rsSellers.Fields.Item("Address1").Value)&",
"&(rsSellers.Fields.Item("Address2").Value)%></option>
<%
rsSellers.MoveNext()
Wend
%>
<%
%>
</select>
Regards
Oliver Dempsey
---
NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS? Is FREE okay?
Visit EarthWeb for the latest in IT Management, Software Development,
Web Development, Networking & Communications, and Hardware & Systems.
Click on http://www.earthweb.com for FREE articles, tutorials,
and discussions from the experts.
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #2 by Xiaopeng Hu <xphu@n...> on 19 Dec 00 12:27:06 PST
|
|
It should work fine if you add a space before "selected" like:
<%if (rsSellers.Fields.Item("SellerID").Value) =3D session("sellerID") th
en
Response.Write " selected"%>
Good luck.
Xiaopeng
"Oliver Dempsey" <odempsey@b...> wrote:
> ---------------------------------------------
> Attachment:=A0
> MIME Type:=A0multipart/alternative
> ---------------------------------------------
I am trying to have the current seller selected in a list box but it won'
t
work.
I cannot for the life of me figure out why this won't work. There is no
error
message but it isn't selecting any of the sellers for me eventhough I've
checked it out and session("sellerID") is always equal to one of the
(rsSellers.Fields.Item("SellerID").Value) 's.
I've embolded the key part of the code for your interest
<select name=3D"select">
<% 'List all Sellers in the sellers table If user i
s
editing property then select the owner of the property
While (NOT rsSellers.EOF)
%>
<option value=3D"<%=3D(rsSellers.Fields.Item("SellerID").Value)%>"<%if
(rsSellers.Fields.Item("SellerID").Value) =3D session("sellerID") then
Response.Write "selected"%>><%=3D(rsSellers.Fields.Item("LastName").Value
)&",
"&(rsSellers.Fields.Item("FirstName").Value)&",
"&(rsSellers.Fields.Item("Address1").Value)&",
"&(rsSellers.Fields.Item("Address2").Value)%></option>
<%
rsSellers.MoveNext()
Wend
%>
<%
%>
</select>
Regards
Oliver Dempsey
---
FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND
INSIGHTS IN YOUR INBOX!
Get the latest and best C++, Visual C++, Java, Visual Basic, and XML tips, tools, and
developments from the experts. Sign up for one or more of EarthWeb?s
FREE IT newsletters at http://www.earthweb.com today!
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #3 by pdf@b... on Tue, 19 Dec 2000 15:48:58 -0500
|
|
--0__=MIkVn7E6Vd3qZTAS8lOQzhxM3egeUeQe0WYO4lJAKQw1f3E7fHxZqIGM
Content-type: text/plain; charset=us-ascii
Content-Disposition: inline
Oliver,
Looking at your code, it seems that you don't have any space preceding the word
"selected" so your output might look something like this:
<option value="1"selected>
I don't know if that is the cause of your problem, but I'd say it's definately
suspect. Try viewing the source of your page in a browser and see if that's how
it's being interpreted.
You can probably correct it by replacing "selected" with " selected".
You might try simplifying it some, making it a little easier to read. Something
like this works for me:
Do While Not rsSellers.EOF
if CInt(session("sellerID")) = CInt(rsSellers("SellerID")) then
%>
<option selected value="<%=rsSellers("SellerID")%>">
<%=rsSellers("LastName") & ", " & rsSellers("FirstName") & ", " &
rsSellers("Address1") & ", " & rsSellers("Address2")%></option>
<%
else
%>
<option value="<%=rsSellers("SellerID")%>"><%=rsSellers("LastName") & ", "
& rsSellers("FirstName") & ", " & rsSellers("Address1") & ", " &
rsSellers("Address2")%></option>
<%
end if
rsSellers.MoveNext
Loop
Hope this helps.
-Peter Foti
"Oliver Dempsey" <odempsey@b...> on 12/19/2000 12:05:37 PM
Please respond to "ASP Databases" <asp_databases@p...>
To: "ASP Databases" <asp_databases@p...>
cc: (bcc: Peter Foti)
Subject: [asp_databases] List Box selected won't work
I am trying to have the current seller selected in a list box but it won't work.
I cannot for the life of me figure out why this won't work. There is no error
message but it isn't selecting any of the sellers for me eventhough I've checked
it out and session("sellerID") is always equal to one of the
(rsSellers.Fields.Item("SellerID").Value) 's.
I've embolded the key part of the code for your interest
<select name="select">
<% 'List all Sellers in the sellers table If user is
editing property then select the owner of the property
While (NOT rsSellers.EOF)
%>
<option value="<%=(rsSellers.Fields.Item("SellerID").Value)%>"<%if
(rsSellers.Fields.Item("SellerID").Value) = session("sellerID") then
Response.Write "selected"%>><%=(rsSellers.Fields.Item("LastName").Value)&",
"&(rsSellers.Fields.Item("FirstName").Value)&",
"&(rsSellers.Fields.Item("Address1").Value)&",
"&(rsSellers.Fields.Item("Address2").Value)%></option>
<%
rsSellers.MoveNext()
Wend
%>
<%
%>
</select>
Regards
Oliver Dempsey
---
NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS? Is FREE okay?
Visit EarthWeb for the latest in IT Management, Software Development,
Web Development, Networking & Communications, and Hardware & Systems.
Click on http://www.earthweb.com for FREE articles, tutorials,
and discussions from the experts.
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
Content-Type: text/plain; charset="us-ascii"
Content-description: footer
---
FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS
IN YOUR INBOX!
Get the latest and best HTML, XML, and JavaScript tips, tools, and
developments from the experts. Sign up for one or more of EarthWeb's
FREE IT newsletters at http://www.earthweb.com today!
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
--0__=MIkVn7E6Vd3qZTAS8lOQzhxM3egeUeQe0WYO4lJAKQw1f3E7fHxZqIGM--
Message #4 by "Dallas Martin" <dmartin@z...> on Tue, 19 Dec 2000 20:18:31 -0500
|
|
Try this. I removed all the "field,item,value" stuff. It's not necessary
and make the code hard to read.
Let me know if this fails
<select name=3D"sellers" size=3D1>
<% while NOT rsSellers.EOF %>
<option value=3D"<%=3DrsSellers("SellerID")%>" <% if
rsSellers("SellerId") =3D Session("SellerID") Then
response.write("SELECTED") END IF %>"><%=3D rsSellers("LastName") & ", "
& rsSellers("FirstName") & ", " & rsSellers("Address1") & ", " &
rsSellers("Address2") %>
</option>
<%
rsSellers.MoveNext
wend
%>
<select>
hth,
Dallas
----- Original Message -----
From: Oliver Dempsey
To: ASP Databases
Sent: Tuesday, December 19, 2000 12:05 PM
Subject: [asp_databases] List Box selected won't work
I am trying to have the current seller selected in a list box but it
won't work.
I cannot for the life of me figure out why this won't work. There is
no error message but it isn't selecting any of the sellers for me
eventhough I've checked it out and session("sellerID") is always equal
to one of the (rsSellers.Fields.Item("SellerID").Value) 's.
I've embolded the key part of the code for your interest
<select name=3D"select">
<% 'List all Sellers in the sellers table If
user is editing property then select the owner of the property
While (NOT rsSellers.EOF)
%>
<option value=3D"<%=3D(rsSellers.Fields.Item("SellerID").Value)%>"<%if
(rsSellers.Fields.Item("SellerID").Value) =3D session("sellerID") then
Response.Write
"selected"%>><%=3D(rsSellers.Fields.Item("LastName").Value)&",
"&(rsSellers.Fields.Item("FirstName").Value)&",
"&(rsSellers.Fields.Item("Address1").Value)&",
"&(rsSellers.Fields.Item("Address2").Value)%></option>
<%
rsSellers.MoveNext()
Wend
%>
<%
%>
</select>
Regards
Oliver Dempsey
---
FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND
INSIGHTS IN YOUR INBOX!
Get the latest and best C++, Visual C++, Java, Visual Basic, and XML tips, tools, and
developments from the experts. Sign up for one or more of EarthWeb?s
FREE IT newsletters at http://www.earthweb.com today!
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #5 by "Oliver Dempsey" <odempsey@b...> on Tue, 19 Dec 2000 23:13:49 -0000
|
|
Thanks for your help Peter, it is much appreciated.
However, I am determined to find why this thing continues to defy me.
I have stripped out the combo box altogether and put in the ID values
before and after the other field values to proof that
session("sellerID") =3D (rsSellers.Fields.Item("SellerID").Value) are
equal.
But the if then statement still doesn't work, would you believe it?????
I even have a demonstration below showing what happens when it prints
out.
It should print "selectedddddddddddddddddddddddddddddddddddddddddddd"
but it's not.
Can anybody solve this mystery?????????
While (NOT rsSellers.EOF)
%>
<%If then
response.write "selectedddddddddddddddddddddddddddddddddddddddddddd"
end if
%>
<%=3Dsession("sellerID")&"
"&(rsSellers.Fields.Item("SellerID").Value)%>
<%=3D(rsSellers.Fields.Item("LastName").Value)&",
"&(rsSellers.Fields.Item("FirstName").Value)&",
"&(rsSellers.Fields.Item("Address1").Value)&",
"&(rsSellers.Fields.Item("Address2").Value)%>
<%=3D" "&session("sellerID")&"
"&(rsSellers.Fields.Item("SellerID").Value)
%><p>
<%
rsSellers.MoveNext()
Wend
%>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D RESULT
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
21 17Dempsey, Oliver, Jamestown, Ballybrittas 21 17
21 18Lott, Kevin, The Castle, Long Avenue 21 18
21 19bloggs, joe, No 1, The Square 21 19
21 20kirwan, paul, jamestown, ballybrittas 21 20
21 21Heffernan, Tim, Templeogue, 21 21
----- Original Message -----
From: pdf@b...
To: ASP Databases
Cc: odempsey@b...
Sent: Tuesday, December 19, 2000 8:48 PM
Subject: Re: [asp_databases] List Box selected won't work
Oliver,
Looking at your code, it seems that you don't have any space preceding
the word
"selected" so your output might look something like this:
<option value=3D"1"selected>
I don't know if that is the cause of your problem, but I'd say it's
definately
suspect. Try viewing the source of your page in a browser and see if
that's how
it's being interpreted.
You can probably correct it by replacing "selected" with " selected".
You might try simplifying it some, making it a little easier to read.
Something
like this works for me:
Do While Not rsSellers.EOF
if CInt(session("sellerID")) =3D CInt(rsSellers("SellerID")) then
%>
<option selected value=3D"<%=3DrsSellers("SellerID")%>">
<%=3DrsSellers("LastName") & ", " & rsSellers("FirstName") & ", " &
rsSellers("Address1") & ", " & rsSellers("Address2")%></option>
<%
else
%>
<option
value=3D"<%=3DrsSellers("SellerID")%>"><%=3DrsSellers("LastName") & ", "
& rsSellers("FirstName") & ", " & rsSellers("Address1") & ", " &
rsSellers("Address2")%></option>
<%
end if
rsSellers.MoveNext
Loop
Hope this helps.
-Peter Foti
---
FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND
INSIGHTS IN YOUR INBOX!
Get the latest and best C++, Visual C++, Java, Visual Basic, and XML tips, tools, and
developments from the experts. Sign up for one or more of EarthWeb?s
FREE IT newsletters at http://www.earthweb.com today!
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #6 by "Oliver Dempsey" <odempsey@b...> on Tue, 19 Dec 2000 23:30:52 -0000
|
|
OK lads
I got it working by putting in the following :-
if
int(session("sellerID"))=3Dint((rsSellers.Fields.Item("SellerID").Value))
.......................blah, blah
But why, can anybody tell me????????????????????
Regards
Oliver Dempsey
---
FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS
IN YOUR INBOX!
Get the latest and best HTML, XML, and JavaScript tips, tools, and
developments from the experts. Sign up for one or more of EarthWeb's
FREE IT newsletters at http://www.earthweb.com today!
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #7 by "Ken Schaefer" <ken@a...> on Wed, 20 Dec 2000 14:18:08 +1100
|
|
<%If then
response.write "selectedddddddddddddddddddddddddddddddddddddddddddd"
end if
%>
If <what?!?> then
you need some kind of condition for the If...then statement to kick in.
Also, you might want to try this:
If CInt(session("sellerID")) = CInt(rsSellers.Fields.Item("SellerID").Value)
then
Response.Write(" selected")
End if
Make sure you test to see that session("sellerID") is numeric using
isNumeric() first, otherwise you'll get a type mismatch. Actually, I'd
futher suggest wrapping the whole thing up in a sub...
<%
Sub subListBoxSelect( _
ByVal intSessionID, _
ByVal intRSValue _
)
If isNumeric(intSessionID) then
If CInt(intSessionID) = CInt(intRSValue) then
Response.Write(" selected")
End if
End if
End Sub
%>
...
<%
Do While Not rsSellers.EOF
intID = rsSellers.Fields.Item("SellerID").Value
Response.Write( _
"<option value=""" & intID& """)
Call subListBoxSelect(session("SellerID"), intID)
Response.Write( _
rsSellers("LastName") & ", " & _
rsSellers("FirstName") & ", " & _
rsSellers("Address1") & ", " & _
rsSellers("Address2") & "</option>" & vbCrLf)
rsSellers.movenext
Loop
%>
Much cleaner looking...easier to read.
Cheers
Ken
----- Original Message -----
From: "Oliver Dempsey" <odempsey@b...>
To: "ASP Databases" <asp_databases@p...>
Sent: Wednesday, December 20, 2000 10:13 AM
Subject: [asp_databases] Re: List Box selected won't work
Thanks for your help Peter, it is much appreciated.
However, I am determined to find why this thing continues to defy me.
I have stripped out the combo box altogether and put in the ID values before
and after the other field values to proof that session("sellerID")
(rsSellers.Fields.Item("SellerID").Value) are equal.
But the if then statement still doesn't work, would you believe it?????
I even have a demonstration below showing what happens when it prints out.
It should print "selectedddddddddddddddddddddddddddddddddddddddddddd" but
it's not.
Can anybody solve this mystery?????????
While (NOT rsSellers.EOF)
%>
<%If then
response.write "selectedddddddddddddddddddddddddddddddddddddddddddd"
end if
%>
<%=session("sellerID")&" "&(rsSellers.Fields.Item("SellerID").Value)%>
<%=(rsSellers.Fields.Item("LastName").Value)&",
"&(rsSellers.Fields.Item("FirstName").Value)&",
"&(rsSellers.Fields.Item("Address1").Value)&",
"&(rsSellers.Fields.Item("Address2").Value)%>
<%=" "&session("sellerID")&" "&(rsSellers.Fields.Item("SellerID").Value)
%><p>
<%
rsSellers.MoveNext()
Wend
%>
============================ RESULT
=========================================
21 17Dempsey, Oliver, Jamestown, Ballybrittas 21 17
21 18Lott, Kevin, The Castle, Long Avenue 21 18
21 19bloggs, joe, No 1, The Square 21 19
21 20kirwan, paul, jamestown, ballybrittas 21 20
21 21Heffernan, Tim, Templeogue, 21 21
----- Original Message -----
From: pdf@b...
To: ASP Databases
Cc: odempsey@b...
Sent: Tuesday, December 19, 2000 8:48 PM
Subject: Re: [asp_databases] List Box selected won't work
Oliver,
Looking at your code, it seems that you don't have any space preceding the
word
"selected" so your output might look something like this:
<option value="1"selected>
I don't know if that is the cause of your problem, but I'd say it's
definately
suspect. Try viewing the source of your page in a browser and see if
that's how
it's being interpreted.
You can probably correct it by replacing "selected" with " selected".
You might try simplifying it some, making it a little easier to read.
Something
like this works for me:
Do While Not rsSellers.EOF
if CInt(session("sellerID")) = CInt(rsSellers("SellerID")) then
%>
<option selected value="<%=rsSellers("SellerID")%>">
<%=rsSellers("LastName") & ", " & rsSellers("FirstName") & ", " &
rsSellers("Address1") & ", " & rsSellers("Address2")%></option>
<%
else
%>
<option value="<%=rsSellers("SellerID")%>"><%=rsSellers("LastName") &
", "
& rsSellers("FirstName") & ", " & rsSellers("Address1") & ", " &
rsSellers("Address2")%></option>
<%
end if
rsSellers.MoveNext
Loop
Hope this helps.
-Peter Foti
---
FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND
INSIGHTS IN YOUR INBOX!
Get the latest and best C++, Visual C++, Java, Visual Basic, and XML tips,
tools, and
developments from the experts. Sign up for one or more of EarthWeb?s
FREE IT newsletters at http://www.earthweb.com today!
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
---
FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS
IN YOUR INBOX!
Get the latest and best HTML, XML, and JavaScript tips, tools, and
developments from the experts. Sign up for one or more of EarthWeb's
FREE IT newsletters at http://www.earthweb.com today!
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #8 by Imar Spaanjaars <Imar@S...> on Wed, 20 Dec 2000 08:58:18 +0100
|
|
Although ASP only knows the datatype Variant, internally "real" datatypes
are used. You probably stored your Session("sellerID") as a string
somewhere (Session("sellerID") = "123") or internally it is represented by
a string.
Therefore, you are trying to compare two different datatypes, which won't
be the same.
By casting them to an int, using int, or Cint, both are of the same
datatype, and will return true when compared.
Imar
At 11:30 PM 12/19/2000 +0000, you wrote:
>OK lads
>I got it working by putting in the following :-
>
>if
>int(session("sellerID"))=int((rsSellers.Fields.Item("SellerID").Value)).......................blah,
>blah
>
>
>But why, can anybody tell me????????????????????
>
>
>Regards
>Oliver Dempsey
>
>
---
FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS
IN YOUR INBOX!
Get the latest and best HTML, XML, and JavaScript tips, tools, and
developments from the experts. Sign up for one or more of EarthWeb's
FREE IT newsletters at http://www.earthweb.com today!
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #9 by "Oliver Dempsey" <odempsey@b...> on Wed, 20 Dec 2000 09:36:09 -0000
|
|
Seems as if my last two emails were mixed up. The last one ended up second
last and the second last one last.
Anyway, I got it sorted out. It seems as if either of variables was a
string.
Thanks for your help.
Oh and thanks for the advice on tidying up, much easier to read!
Regards
Oliver Dempsey
----- Original Message -----
From: Ken Schaefer <ken@a...>
To: ASP Databases <asp_databases@p...>
Sent: Wednesday, December 20, 2000 3:18 AM
Subject: [asp_databases] Re: List Box selected won't work
> <%If then
> response.write "selectedddddddddddddddddddddddddddddddddddddddddddd"
> end if
> %>
>
> If <what?!?> then
> you need some kind of condition for the If...then statement to kick in.
>
> Also, you might want to try this:
>
> If CInt(session("sellerID"))
CInt(rsSellers.Fields.Item("SellerID").Value)
> then
> Response.Write(" selected")
> End if
>
> Make sure you test to see that session("sellerID") is numeric using
> isNumeric() first, otherwise you'll get a type mismatch. Actually, I'd
> futher suggest wrapping the whole thing up in a sub...
>
> <%
> Sub subListBoxSelect( _
> ByVal intSessionID, _
> ByVal intRSValue _
> )
>
> If isNumeric(intSessionID) then
> If CInt(intSessionID) = CInt(intRSValue) then
> Response.Write(" selected")
> End if
> End if
>
> End Sub
> %>
> ...
> <%
> Do While Not rsSellers.EOF
> intID = rsSellers.Fields.Item("SellerID").Value
>
> Response.Write( _
> "<option value=""" & intID& """)
>
> Call subListBoxSelect(session("SellerID"), intID)
>
> Response.Write( _
> rsSellers("LastName") & ", " & _
> rsSellers("FirstName") & ", " & _
> rsSellers("Address1") & ", " & _
> rsSellers("Address2") & "</option>" & vbCrLf)
>
> rsSellers.movenext
> Loop
> %>
>
> Much cleaner looking...easier to read.
>
> Cheers
> Ken
>
>
>
>
>
>
>
>
>
>
>
> ----- Original Message -----
> From: "Oliver Dempsey" <odempsey@b...>
> To: "ASP Databases" <asp_databases@p...>
> Sent: Wednesday, December 20, 2000 10:13 AM
> Subject: [asp_databases] Re: List Box selected won't work
>
>
> Thanks for your help Peter, it is much appreciated.
> However, I am determined to find why this thing continues to defy me.
> I have stripped out the combo box altogether and put in the ID values
before
> and after the other field values to proof that session("sellerID")
> (rsSellers.Fields.Item("SellerID").Value) are equal.
> But the if then statement still doesn't work, would you believe it?????
> I even have a demonstration below showing what happens when it prints out.
> It should print "selectedddddddddddddddddddddddddddddddddddddddddddd"
but
> it's not.
>
> Can anybody solve this mystery?????????
>
>
>
>
> While (NOT rsSellers.EOF)
> %>
>
> <%If then
> response.write "selectedddddddddddddddddddddddddddddddddddddddddddd"
> end if
> %>
> <%=session("sellerID")&" "&(rsSellers.Fields.Item("SellerID").Value)%>
> <%=(rsSellers.Fields.Item("LastName").Value)&",
> "&(rsSellers.Fields.Item("FirstName").Value)&",
> "&(rsSellers.Fields.Item("Address1").Value)&",
> "&(rsSellers.Fields.Item("Address2").Value)%>
> <%=" "&session("sellerID")&" "&(rsSellers.Fields.Item("SellerID").Value)
>
> %><p>
> <%
> rsSellers.MoveNext()
> Wend
> %>
> ============================ RESULT
> =========================================
>
> 21 17Dempsey, Oliver, Jamestown, Ballybrittas 21 17
> 21 18Lott, Kevin, The Castle, Long Avenue 21 18
>
> 21 19bloggs, joe, No 1, The Square 21 19
>
> 21 20kirwan, paul, jamestown, ballybrittas 21 20
>
> 21 21Heffernan, Tim, Templeogue, 21 21
>
>
>
> ----- Original Message -----
> From: pdf@b...
> To: ASP Databases
> Cc: odempsey@b...
> Sent: Tuesday, December 19, 2000 8:48 PM
> Subject: Re: [asp_databases] List Box selected won't work
>
>
>
>
> Oliver,
> Looking at your code, it seems that you don't have any space preceding
the
> word
> "selected" so your output might look something like this:
> <option value="1"selected>
> I don't know if that is the cause of your problem, but I'd say it's
> definately
> suspect. Try viewing the source of your page in a browser and see if
> that's how
> it's being interpreted.
> You can probably correct it by replacing "selected" with " selected".
> You might try simplifying it some, making it a little easier to read.
> Something
> like this works for me:
>
> Do While Not rsSellers.EOF
> if CInt(session("sellerID")) = CInt(rsSellers("SellerID")) then
> %>
> <option selected value="<%=rsSellers("SellerID")%>">
> <%=rsSellers("LastName") & ", " & rsSellers("FirstName") & ", " &
> rsSellers("Address1") & ", " & rsSellers("Address2")%></option>
> <%
> else
> %>
> <option value="<%=rsSellers("SellerID")%>"><%=rsSellers("LastName")
&
> ", "
> & rsSellers("FirstName") & ", " & rsSellers("Address1") & ", " &
> rsSellers("Address2")%></option>
> <%
> end if
> rsSellers.MoveNext
> Loop
>
> Hope this helps.
> -Peter Foti
>
>
---
FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND
INSIGHTS IN YOUR INBOX!
Get the latest and best C++, Visual C++, Java, Visual Basic, and XML tips, tools, and
developments from the experts. Sign up for one or more of EarthWeb?s
FREE IT newsletters at http://www.earthweb.com today!
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
|
|
 |