I have a databound dropdown in my page. I want to make one of the
values the default value. Any ideas?
Just to explain further, I have also appended one item to the dropdown,
using the AppendDataBoundItems="True" property of the dropdown.
Unfortunately the item I have appended to the dropdown has become the
default value of the dropdown list which is not what I want.
Kind regards,
Steve. 3 1226
myDropDown.SelectedIndex =
myDropDown.Items.IndexOf(myDropDown.Items.FindByVa lue("yourDefaultValue"))
you can also use FindByText which uses the text, instead of the value.
Karl
-- http://www.openmymind.net/ http://www.codebetter.com/
"Steve" <ba****@iranmania.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
>I have a databound dropdown in my page. I want to make one of the
values the default value. Any ideas?
Just to explain further, I have also appended one item to the dropdown,
using the AppendDataBoundItems="True" property of the dropdown.
Unfortunately the item I have appended to the dropdown has become the
default value of the dropdown list which is not what I want.
Kind regards,
Steve.
Thank you for this Karl.
Should I put this code in the page load event in page behind or can I
somehow put it as a parameter in between the dropdown tags in the page
itself.
Kind regads,
Steve
Karl Seguin [MVP] wrote:
myDropDown.SelectedIndex =
myDropDown.Items.IndexOf(myDropDown.Items.FindByVa lue("yourDefaultValue"))
you can also use FindByText which uses the text, instead of the value.
Karl
-- http://www.openmymind.net/ http://www.codebetter.com/
"Steve" <ba****@iranmania.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
I have a databound dropdown in my page. I want to make one of the
values the default value. Any ideas?
Just to explain further, I have also appended one item to the dropdown,
using the AppendDataBoundItems="True" property of the dropdown.
Unfortunately the item I have appended to the dropdown has become the
default value of the dropdown list which is not what I want.
Kind regards,
Steve.
I'm pretty sure you're stuck doing it in codebehind.
Karl
-- http://www.openmymind.net/ http://www.codebetter.com/
"Steve" <ba****@iranmania.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Thank you for this Karl.
Should I put this code in the page load event in page behind or can I
somehow put it as a parameter in between the dropdown tags in the page
itself.
Kind regads,
Steve
Karl Seguin [MVP] wrote:
>myDropDown.SelectedIndex = myDropDown.Items.IndexOf(myDropDown.Items.FindByV alue("yourDefaultValue"))
you can also use FindByText which uses the text, instead of the value.
Karl
-- http://www.openmymind.net/ http://www.codebetter.com/
"Steve" <ba****@iranmania.comwrote in message news:11**********************@b28g2000cwb.googleg roups.com...
>I have a databound dropdown in my page. I want to make one of the
values the default value. Any ideas?
Just to explain further, I have also appended one item to the dropdown,
using the AppendDataBoundItems="True" property of the dropdown.
Unfortunately the item I have appended to the dropdown has become the
default value of the dropdown list which is not what I want.
Kind regards,
Steve. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Lyn |
last post by:
Hi,
Can anyone tell me how the initial value displayed in Combo Box is
determined when a form is opened?
I am loading the dropdown from one field ("CategoryName") of a table, with
"ORDER BY ". ...
|
by: Kannan.M.R |
last post by:
Hi,
I have a problem in assigning the selected value in the dropdown
to a hidden control. It goes like this.
I have a repeater control. In the repeater control’s item template, I have a...
|
by: Kannan.M.R |
last post by:
hi,
I have a repeater. In the item template of the repeater i have a place
holder control. In the item databound event of the repeater, In a for loop, i
create dropdowns and buttons in a loop and...
|
by: Randall Parker |
last post by:
Using DropDownList to create select/option tags in HTML how to make the first option
be a blank string?
I have fields with optional values. Currently I'm populating the DropDownList by
querying...
|
by: Brian Henry |
last post by:
say I have a databound combo box, which allows for text entry still
(DropDownStype = DropDown in this case).
now, If the user doesn't enter manually an item in the data bound list,
nothing...
|
by: Ami Schreiber |
last post by:
I want to insert a default null ListItem with the text "choose an item ..."
in my DropDownList control. I have seen similar postings here regarding this
issue but all of them seem to focus around...
|
by: Ben |
last post by:
I have a formview with a few dropdownlists (software version, database
version, etc). When a software version is selected, the database version
dropdownlist updates itself accordingly. When in...
|
by: Lair |
last post by:
I am creating a page that has three to four databound dropdown lists.
Each one is has different data sometimes from the same table but with a
different where clause. What is the best way to...
|
by: podi |
last post by:
Hi,
I just wonder if there is a way to set a selected item in dropdown list
which items are retreived from database without touching c# code ?
I mean, i have in gridview, in edit mode one...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
| |