473,809 Members | 2,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Advantage of DataValueField

Dear All,

I am actually a bit confused about DataValueField. I know what is the use
of
DataTextField.B ut 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.H as
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 2831
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**********@ho tmail.com

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

I am actually a bit confused about DataValueField. I know what is the use
of
DataTextField.B ut 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.H as
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********@dis cussions.micros oft.com> wrote in message
news:9A******** *************** ***********@mic rosoft.com...
Dear All,

I am actually a bit confused about DataValueField. I know what is the
use
of
DataTextField.B ut 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.H as
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********@dis cussions.micros oft.com> wrote in message
news:9A******** *************** ***********@mic rosoft.com...
Dear All,

I am actually a bit confused about DataValueField. I know what is the use of
DataTextField.B ut 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.H as 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
1825
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 everything declared in the public section of the derived class and the base class and sometimed it is an disadvantage. Another important advantage is that wherever you can use an object of base class you can also use an object of it's derived class...
1
5841
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 or OpenRowSet. I've tried variations on: select * from OpenDataSource( 'Advantage OLE DB Provider',
5
6532
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
2923
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
6557
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
5532
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 that the custom attribute can be accessed using javascript? Cheers
0
1261
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 will see in the html. There is no way to do that on the database, it has to be done on the .net side.
1
7464
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). the dropdown list is populated by a query to a datbase table. loaded with a datareader like below: Dlist.DataSource = myCommand.ExecuteReader(); Dlist.DataTextField = TextField; (this would be a name, "Jones Inc.")
4
1912
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 initial value I can use ddlb.SelectedValue="Florida" In other words, SelectedValue is the DataTextField How do I set the initial value to the DataValueField? ddlb.SelectedValue="FL" doesnt work (or is it just me?)
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9601
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10637
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10379
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10115
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9199
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3014
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.