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

Advantage of DataValueField

Dear All,

I am actually a bit confused about DataValueField. I know what is the use
of
DataTextField.But dont know anything about DataValue Field.Is it necessary
to use DataValue field whenever we bind any Dropdownbox or listBox.What
if we dont use DataValue field at all and stick with only DataTextField.Has
any 1 encountered any problems when not using DataValueField.What are the
advantages and disadvantages of DataValueField. Any help would be greatly
appreciated.

Cheers,
Sunil Sabir
Nov 19 '05 #1
3 2819
The DataValueField is there so that, for example, if you have a drop
down list of people's names, you can bind the DataValueField to the
primary key of the 'people' table.
-Jason Kendall
Ja**********@hotmail.com

On Tue, 1 Feb 2005 06:21:07 -0800, "Sunil Sabir"
<Su********@discussions.microsoft.com> wrote:
Dear All,

I am actually a bit confused about DataValueField. I know what is the use
of
DataTextField.But dont know anything about DataValue Field.Is it necessary
to use DataValue field whenever we bind any Dropdownbox or listBox.What
if we dont use DataValue field at all and stick with only DataTextField.Has
any 1 encountered any problems when not using DataValueField.What are the
advantages and disadvantages of DataValueField. Any help would be greatly
appreciated.

Cheers,
Sunil Sabir


Nov 19 '05 #2
DataValue Field is useful for dynamically populated lists. Usually from
database where each ListItem is matched by an entry in a database with a
unique ID. This was the user can select by picking the Text that they
recognise and then the code would use the Value or ID in this case to
perform its work.
MattC

"Sunil Sabir" <Su********@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
Dear All,

I am actually a bit confused about DataValueField. I know what is the
use
of
DataTextField.But dont know anything about DataValue Field.Is it
necessary
to use DataValue field whenever we bind any Dropdownbox or listBox.What
if we dont use DataValue field at all and stick with only
DataTextField.Has
any 1 encountered any problems when not using DataValueField.What are
the
advantages and disadvantages of DataValueField. Any help would be
greatly
appreciated.

Cheers,
Sunil Sabir

Nov 19 '05 #3
Sunil,

You should use DataValueField if you need it. Feel free not to use it if you
don't need it.
An example when you need it:
Consider an application where a user should select a country from a dropdown
list. On the screen you would want to show full country name (like
"Russia"). In the database you would want to store the country code (like
"RU"). Let's say you have a table with all country names and codes.You would
want to set DataTextField to the field holding the country name and
DataValueField to the one holding the country code.

Eliyahu

"Sunil Sabir" <Su********@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
Dear All,

I am actually a bit confused about DataValueField. I know what is the use of
DataTextField.But dont know anything about DataValue Field.Is it necessary to use DataValue field whenever we bind any Dropdownbox or listBox.What
if we dont use DataValue field at all and stick with only DataTextField.Has any 1 encountered any problems when not using DataValueField.What are the advantages and disadvantages of DataValueField. Any help would be greatly appreciated.

Cheers,
Sunil Sabir

Nov 19 '05 #4

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

Similar topics

2
by: Tony Johansson | last post by:
Hello experts! My question is what advantage and disadvantage have public inheritance. The answer that I have to this is that sometimes it is an advantage to let a client have access to...
1
by: David Horowitz | last post by:
Hi folks. I'm trying to connect to a Medisoft Advantage SQL db through SQL Server using OpenDataSource or OpenRowSet. I have general connections to the db working fine, but not with OpenDataSource...
5
by: RF | last post by:
How can I do something like this AuthorList.DataValueField = "au_lname" &"-"& "au_id" I want to concatenate two columns together. Any ideas??
1
by: Sam | last post by:
I want to create dropdownlist where DataTextField and DataValueField are extract from table gldate. Example Dropdownlist -> Jan-2005 -> Feb-2005 ... ... -> Dec-2005
3
by: tshad | last post by:
How do I get to the datatextfield of listbox? I can get the the datavaluefield using the selectedvalue. I want to get the text portion of the listbox that the user selected. Thanks, Tom
3
by: Dune | last post by:
Hi, Is there anyway to get the datavaluefield from a databound checkboxlist using javascript? If not, is there any way to associate a custom attribute with the databound checkboxlist items so...
0
by: Gerald | last post by:
Hi, Is it possible to do some action on the value that will be the DataValueField of a listbox? I have a listbox with a list of item. But I would like to encode the value ID that the client...
1
by: Eric W. Holzapfel | last post by:
Hello Group, As far as a dropdownlist, is there a way to access both values for the datatextfield (like a name, etc) AND the value of the datavaluefield (like a record number, or index etc). ...
4
by: =?Utf-8?B?U2FuZHBvaW50R3V5?= | last post by:
I have a dropdown of states that is populated from a table, that looks like ddlb.DataValueField="StateCode" // ex: FL ddlb.DataTextField="StateDescription" // ex: Florida If I want to set the...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.