473,385 Members | 2,162 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,385 software developers and data experts.

Binding two data columns to DataTextField

Hi everyone,

Is it possible to bind the DataTextField property to two values from a
database.

I would like the text from column("book") and the text from
column("code") to appear in the DataTextField of a dropdown.

If this is not possible is there are work around?
Thanks
Angela
Nov 18 '05 #1
2 9275
Ben
I'm sure there are many approaches to this, but I would do it inside
OnItemDataBind. Create a datarowview, and process information as necessary.
"Angela" <an****@kaisen.co.uk> wrote in message
news:6f**************************@posting.google.c om...
Hi everyone,

Is it possible to bind the DataTextField property to two values from a
database.

I would like the text from column("book") and the text from
column("code") to appear in the DataTextField of a dropdown.

If this is not possible is there are work around?
Thanks
Angela


Nov 18 '05 #2
You can accomplish this easily by creating the item displayed in your SQL
statement:
Select book + ' ' + code as BookCode from (YourTableName)
Then, use 'BookCode' as your DataTextField

David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com
"Angela" <an****@kaisen.co.uk> wrote in message
news:6f**************************@posting.google.c om...
Hi everyone,

Is it possible to bind the DataTextField property to two values from a
database.

I would like the text from column("book") and the text from
column("code") to appear in the DataTextField of a dropdown.

If this is not possible is there are work around?
Thanks
Angela

Nov 18 '05 #3

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

Similar topics

4
by: ShadowsOfTheBeast | last post by:
hi oliver thanks for your help i kinda figured that out minutes afterwards...but what i am actually trying to do is this: i have a listbox control that gets its data from another listbox (hence...
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...
2
by: rmorvay | last post by:
I am trying to dynamically build a dropdownlist and bind it to a cell in a grid. I tried to utilize the following code but I am stuck at the point where I bind the dropdownlist to the grid cell. ...
6
by: Morten | last post by:
Hi! I've made my own webservice which returns a collection of objects with 4 properties (or fields when they get returned from the webservice...). Is there an easy way to display each object...
3
by: Binod Nair | last post by:
Hi All, This is what I am trying to do.I have an aspx page with the the following code block. <asp:DropDownList id="DropDownList1" runat="server" DataSource="<%# GetUsers%>"...
5
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
string connectionString1 = "server=(local); user=sa;password=sa; database=sonic"; System.Data.SqlClient.SqlConnection dbConnection1 = new System.Data.SqlClient.SqlConnection(connectionString1);...
9
by: Timm | last post by:
I have an ASP.NET 2.0 page with two DropDownLists. I am using declarative data binding wherever possible and trying to minimize the use of code. The list of values in DropDownList DDL2 should be...
6
by: p.mc | last post by:
Hi all, I'm having major problems with a userControl which contains a datagrid. My problem concerns data binding. The Page_Load() procedure calls the DataBind procedure to bind the datagrid...
0
by: Nam | last post by:
I want to use the same sqlDataSource for two CheckBoxList controls in ASP.NET 2.0. For simplicity, I am using the case of only two CheckBoxList controls in the following example: My...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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,...
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,...

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.