473,395 Members | 1,452 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Display 2 Columns from a datasource in a DropDownList

Hi,

Is it possible to DISPLAY 2 columns somehow in a dropdownlist?

For example:

DataField Value = bound to ProductId

DataField Display = Product Name and Product Number

Thanks for any tips.

Frank
Feb 21 '07 #1
3 1885
other than using a fixedwidth font and spaces, no. you can build your
own dropdown in javascript.

-- bruce (sqlwork.com)

news-server.maine.rr.com wrote:
Hi,

Is it possible to DISPLAY 2 columns somehow in a dropdownlist?

For example:

DataField Value = bound to ProductId

DataField Display = Product Name and Product Number

Thanks for any tips.

Frank

Feb 21 '07 #2
Frank if inunderstand you do you want to have for example
"FirstName, Lastname" displayed in the dropdowen menu?
Patrick

"news-server.maine.rr.com" <Fr***@yahoo.comwrote in message
news:45***********************@roadrunner.com...
Hi,

Is it possible to DISPLAY 2 columns somehow in a dropdownlist?

For example:

DataField Value = bound to ProductId

DataField Display = Product Name and Product Number

Thanks for any tips.

Frank

Feb 21 '07 #3
For anyone else, my solution was to use an ObjectDataSource that pointed to
a custom class and method which does the database access, then returns a
collection of ListItems to be used by the DropDownList.

While pulling the fields from the SqlDataReader, I built ListItems and set
the ListItem.Text = sqlDataReader["field1"].ToString() + " " +
sqlDataReader["field2"].ToString();

Then I set the value:

myListItem.Value = "RowID";

Then add each ListItem to an ListItemCollection, and return that Collection
to the ObjectDataSource.

Works like a charm.

Frank

Feb 21 '07 #4

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

Similar topics

1
by: cw bebop | last post by:
Is there a way to bind two columns from a table to one DropDownList? Below I have the column databound to DropDownList1 and would like to also have the column bound to the same DropDownList1...
18
by: Alpha | last post by:
Hi, I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a listbox that I have binded to a dataset table, "source" which has 3 columns. I would like to display 2 of those...
1
by: André Almeida Maldonado | last post by:
Hy Guys.. I have a datagrid with template columns. The datagrid have a datatable datasource. But when I try to bind data, I receive this error: DataBinder.Eval:...
1
by: Luis Esteban Valencia | last post by:
Here is my aspx code: ============= <%@ Page language="c#" Codebehind="WebForm3.aspx.cs" AutoEventWireup="false" Inherits="PDM.excel.WebForm3" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0...
2
by: Marc Robitaille | last post by:
Hello, I set the DataSource property of a DropDownList to as DataSet that is filled from a SQLDataAdapter. The AutoPostBack property of that DropDownList is set to True. When the...
2
by: John Smith | last post by:
Will this line of the code: item.Cells.Text = "Some text..."; change only DataGrid visual value or it will also change value in the DataSource? How can I change value in DataSource? ...
1
by: Justin | last post by:
Hi all, I have a bunch of drop-down lists that should each display an item (from a SQL Server lookup table) based on another piece of data from a separate table. For example; If Not...
7
by: avanthika | last post by:
hi, I am using dropdownlist in webgrid.for loading the combo i am using this source code. Dim vallist As New Infragistics.WebUI.UltraWebGrid.ValueList Dim ds As New DataSet ...
1
by: Wingot | last post by:
Hey, I have an application codenamed WingFlex. It has a number of aspects to it, but the prudent parts for this problem are all within the "Client" Schema. The Client schema has three tables...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.