How do you force a drop down list to default to a particular item based on
its value?
I have a drop down list with options Yes, No, Maybe, All, and I would like
it to default to "All"
This is my code, what am I doing wrong?
ddlBilling.SelectedIndex =
ddlBilling.Items.IndexOf(ddlBilling.Items.FindByVa lue("All")) 3 1777
ddl.ClearSelection() // in case something else is selected
ddl.Items.FindByValue("All").Selected = true
-Brock http://staff.develop.com/ballen How do you force a drop down list to default to a particular item based on its value?
I have a drop down list with options Yes, No, Maybe, All, and I would like it to default to "All"
This is my code, what am I doing wrong? ddlBilling.SelectedIndex = ddlBilling.Items.IndexOf(ddlBilling.Items.FindByVa lue("All"))
That looks fine...is that the value of the dropdown or the text?
if it's the text, you need to use FindByText
Otherwise, where is this code?are you binding before?
Karl
-- http://www.openmymind.net/
"KatMagic" <SS********@yahoo.com> wrote in message
news:ue**************@TK2MSFTNGP05.phx.gbl... How do you force a drop down list to default to a particular item based on its value?
I have a drop down list with options Yes, No, Maybe, All, and I would like it to default to "All"
This is my code, what am I doing wrong? ddlBilling.SelectedIndex = ddlBilling.Items.IndexOf(ddlBilling.Items.FindByVa lue("All"))
Thanks everyone you were very helpful. As you suggested, I was incorrectly
attempting to select by value, when "All" was a text value. Clearing the
selection and selecting by the actual value (0), worked! Thanks.
"KatMagic" <SS********@yahoo.com> wrote in message
news:ue**************@TK2MSFTNGP05.phx.gbl... How do you force a drop down list to default to a particular item based on its value?
I have a drop down list with options Yes, No, Maybe, All, and I would like it to default to "All"
This is my code, what am I doing wrong? ddlBilling.SelectedIndex = ddlBilling.Items.IndexOf(ddlBilling.Items.FindByVa lue("All"))
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bogdan Zamfir |
last post by:
Hi,
I have a page called MyTargetPage.aspx with a drop down list.
When I pass control to that page, I send an ID in querystring, like this
Server.transfer("MyTargetPage.aspx?PrjID=" &...
|
by: Novice Computer User |
last post by:
I have a drop down menu where people are able to select 1 item.
However, I want to modify the drop down list so that the person can
select more than 1 item (i.e by holding down the shift button...
|
by: John Walker |
last post by:
Hi,
On an ASP.NET page I have a drop down list control. When the user pulls
down the list and makes a selection, I perform validation, and if the
validation fails I want the selected item in...
|
by: Mike Wilson |
last post by:
Dear Group,
I have a heirarchical set of database tables, say - "order" and "order_type"
and want to display a series of orders in a grid control, and in place of
the order_type foreign key...
|
by: yogeshtiwarijbp |
last post by:
when i select data from the drop down list box and display data in the datagrid
the first data in the dropdownlistbox not shown the requireddata in the grid. i have used 2 tables and after selecting...
| |
by: SQLjunky |
last post by:
Hello,
Contrary to what my screen name indicates, i'm actually quite new to SQL.
Having said that, I'll get right into my problem.
I'm trying to query an mssql database to return to the value...
|
by: SunnySnow29 |
last post by:
Hi,
I have a 2 drop down lists in C# populated with data from a SQL 2005 db.
When a new item of data is inserted the second list must update to reflect the change (the first drop down list will...
|
by: mark.norgate |
last post by:
Hi
Another problem...
My drop down is always defaulting to selecting the first item in the
drop down, even though I've got code specifically to change it to a
different item:
Dim adapter...
|
by: bytenut |
last post by:
I would like to display two field values in a combo after selecting from the list items...
i.e. my drop-down shows two fields from a lookup, but when I select the item, only the first field value is...
|
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,...
|
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: 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...
|
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...
|
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,...
|
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...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |