473,799 Members | 3,080 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

specifying datavaluefield in ddlb

I have a dropdown of states that is populated from a table, that looks like
ddlb.DataValueF ield="StateCode " // ex: FL
ddlb.DataTextFi eld="StateDescr iption" // ex: Florida

If I want to set the initial value I can use
ddlb.SelectedVa lue="Florida"
In other words, SelectedValue is the DataTextField

How do I set the initial value to the DataValueField?
ddlb.SelectedVa lue="FL" doesnt work (or is it just me?)

Thanks, Mark
Sep 27 '07 #1
4 1911
There is no SelectedText property for the drop down list box.

"Mike" wrote:
you can do

dd.SelectedText = "FL";

is the value for Florida acutally FL?

Mike
"SandpointG uy" <Sa**********@d iscussions.micr osoft.comwrote in message
news:83******** *************** ***********@mic rosoft.com...
I have a dropdown of states that is populated from a table, that looks like
ddlb.DataValueF ield="StateCode " // ex: FL
ddlb.DataTextFi eld="StateDescr iption" // ex: Florida

If I want to set the initial value I can use
ddlb.SelectedVa lue="Florida"
In other words, SelectedValue is the DataTextField

How do I set the initial value to the DataValueField?
ddlb.SelectedVa lue="FL" doesnt work (or is it just me?)

Thanks, Mark


Sep 27 '07 #2
you can do

dd.SelectedText = "FL";

is the value for Florida acutally FL?

Mike
"SandpointG uy" <Sa**********@d iscussions.micr osoft.comwrote in message
news:83******** *************** ***********@mic rosoft.com...
>I have a dropdown of states that is populated from a table, that looks like
ddlb.DataValueF ield="StateCode " // ex: FL
ddlb.DataTextFi eld="StateDescr iption" // ex: Florida

If I want to set the initial value I can use
ddlb.SelectedVa lue="Florida"
In other words, SelectedValue is the DataTextField

How do I set the initial value to the DataValueField?
ddlb.SelectedVa lue="FL" doesnt work (or is it just me?)

Thanks, Mark

Sep 27 '07 #3
try this:
dd.SelectedItem .Text = "FL";

or if you know the index number of Fl you can do

dd.SelectedInde x = 5 (or whatever FL is)

Mike
"SandpointG uy" <Sa**********@d iscussions.micr osoft.comwrote in message
news:F2******** *************** ***********@mic rosoft.com...
There is no SelectedText property for the drop down list box.

"Mike" wrote:
>you can do

dd.SelectedTex t = "FL";

is the value for Florida acutally FL?

Mike
"SandpointGu y" <Sa**********@d iscussions.micr osoft.comwrote in message
news:83******* *************** ************@mi crosoft.com...
>I have a dropdown of states that is populated from a table, that looks
like
ddlb.DataValueF ield="StateCode " // ex: FL
ddlb.DataTextFi eld="StateDescr iption" // ex: Florida

If I want to set the initial value I can use
ddlb.SelectedVa lue="Florida"
In other words, SelectedValue is the DataTextField

How do I set the initial value to the DataValueField?
ddlb.SelectedVa lue="FL" doesnt work (or is it just me?)

Thanks, Mark



Sep 27 '07 #4

Actually, SelectedItem.Va lue is closer to what I want. But it adds a new
entry at the top, rather than selecting the existing value of "FL"

In other words, I get :
<option value="FL" selected="selec ted" value="FL">Alab ama
<option value="AL">Alab ama
.... other states
<option value="FL">Flor ida

And what I want is:
<option value="FL" selected="selec ted">Florida
<option value="AL">Alab ama
.... other states
"Mike" wrote:
try this:
dd.SelectedItem .Text = "FL";

or if you know the index number of Fl you can do

dd.SelectedInde x = 5 (or whatever FL is)

Mike
"SandpointG uy" <Sa**********@d iscussions.micr osoft.comwrote in message
news:F2******** *************** ***********@mic rosoft.com...
There is no SelectedText property for the drop down list box.

"Mike" wrote:
you can do

dd.SelectedText = "FL";

is the value for Florida acutally FL?

Mike
"SandpointG uy" <Sa**********@d iscussions.micr osoft.comwrote in message
news:83******** *************** ***********@mic rosoft.com...
I have a dropdown of states that is populated from a table, that looks
like
ddlb.DataValueF ield="StateCode " // ex: FL
ddlb.DataTextFi eld="StateDescr iption" // ex: Florida

If I want to set the initial value I can use
ddlb.SelectedVa lue="Florida"
In other words, SelectedValue is the DataTextField

How do I set the initial value to the DataValueField?
ddlb.SelectedVa lue="FL" doesnt work (or is it just me?)

Thanks, Mark


Sep 27 '07 #5

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

Similar topics

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??
3
2831
by: Sunil Sabir | last post by:
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...
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
6556
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.")
0
2390
by: Mike P | last post by:
Where exactly are the updateparameters of a gridview picked up from? I have created 2 very similar gridviews and given the updateparameters the same names as in my edititemtemplates. Yet this method has worked for 1 gridview and failed for the second gridview. Here is my gridview : <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:XConnectionString %>" SelectCommand="ViewForecast"...
2
1016
by: MarkAurit | last post by:
Depending on the month selected elsewhere I show a variable number of days in a drop down list box. What is the simplest way to clear the entries out of a drop down list box so I can always refresh it from the start? I see the ListItemCollection class has a Clear method (which sounds like what I want), but I dont see it in the ddlb. Thanks, Mark
0
9687
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
9541
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
10027
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
9072
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...
1
7565
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
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.