Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Simple question on populating drop down list display?


Message #1 by "Thomas Fuller" <tfuller@g...> on Fri, 26 Jul 2002 16:00:10
Thanks again for all the help!

-----Original Message-----
From: Ray Jezek (TT) [mailto:ray.jezek@t...] 
Sent: Friday, July 26, 2002 12:01 PM
To: ASPX_Professional
Subject: [aspx_professional] RE: Simple question on populating drop do wn l
ist display?

The only thing that cannot be implicitly converted to a varchar is money,
smallmoney, image, and ntext.  There is no long in sql, but this will handle
Reals just fine.

 -----Original Message-----
From: 	Thomas Fuller [mailto:TFuller@g...] 
Sent:	Friday, July 26, 2002 10:55 AM
To:	ASPX_Professional
Subject:	[aspx_professional] RE: Simple question on populating drop
do wn l ist display?

Will it handle any integer type?  Like smallint, long, etc.  Basically is
there anything that will cause it to throw an exception?  By the way thanks
for all the help!!!!

Tom Fuller

-----Original Message-----
From: Ray Jezek (TT) [mailto:ray.jezek@t...] 
Sent: Friday, July 26, 2002 11:48 AM
To: ASPX_Professional
Subject: [aspx_professional] RE: Simple question on populating drop do wn l
ist display?

Yes, just using varchar will handle any int.

Try this in QA if you want to test this:

select CONVERT(varchar,214748364799999999999999)

 -----Original Message-----
From: 	Thomas Fuller [mailto:TFuller@g...] 
Sent:	Friday, July 26, 2002 10:44 AM
To:	ASPX_Professional
Subject:	[aspx_professional] RE: Simple question on populating drop
do wn l ist display?

So just putting in varchar will make it dynamic enough to handle whatever
the size may be?  Is that what you're saying?

-----Original Message-----
From: Ray Jezek (TT) [mailto:ray.jezek@t...] 
Sent: Friday, July 26, 2002 11:35 AM
To: ASPX_Professional
Subject: [aspx_professional] RE: Simple question on populating drop do wn l
ist display?

CONVERT(varchar,myInt) + myVarchar

 -----Original Message-----
From: 	Thomas Fuller [mailto:TFuller@g...] 
Sent:	Friday, July 26, 2002 10:22 AM
To:	ASPX_Professional
Subject:	[aspx_professional] RE: Simple question on populating drop
do wn l ist display?

This is exactly what I needed thanks.  However, I am having a problem with
concatenating fields of different types.  How could I concatenate say a
Integer field to a varchar field.  Right now SQL will throw an exception.

Tom

-----Original Message-----
From: jdonahue@f... [mailto:jdonahue@f...] 
Sent: Friday, July 26, 2002 12:26 PM
To: ASPX_Professional
Subject: [aspx_professional] RE: Simple question on populating drop down l
ist display?

Like Biju said, you can have the stored proc return the concatenated 
value.  If you aren't using stored procs, you can do it as follows (this 
code uses a listbox...just revise it to use a drop down list):

'create ListBox
strSQL = "SELECT *,mytable.fieldname1+' - '+mytable.fieldname2 As 
Listdata FROM mytable
Dim objDataView As DataView
objDataView = GetDataView(strSQL, mytable)
If IsNothing(objDataView) OR objDataViewCount < 1 Then
   'handle exception
Else
   ListBox.DataSource = objDataView
   ListBox.DataValueField = "<field name for value>"
   ListBox.DataTextField = "Listdata"
   ListBox.DataBind()
EndIf

Should be simple enough to change the listbox to a dropdown list.

-Jim


> Have the stored proc return the concatenated value.

-Biju

-----Original Message-----
From: Thomas Fuller [mailto:tfuller@g...]
Sent: Friday, July 26, 2002 9:00 AM
To: ASPX_Professional
Subject: [aspx_professional] Simple question on populating drop down
list display?


Is there a way to bind multiple fields to the datatextfield.  For example 
I have a drop down list that I want to show multiple columns from the 
database as display.  Still only one on the value but I may want to have 
the display do something like DB("ITEM1") & " - " & db("ITEMDESCR").  Has 
anyone seen a way of doing this?

Thanks,
Tom Fuller












  Return to Index