473,399 Members | 3,106 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,399 software developers and data experts.

DropDown List Default Selected Item

Hello (again),

I have gotten the dropdown list functionality to work through a few tricks
(probably not the most efficient, but it works) but I am not sure how to set
the default selected value. I have tried setting various values to represent
the default value with little success. Essentially I am looking to have the
first item in the list be the default selected item. I noticed in the
properties for a dtat grid you could set a default selected index
(DataGrid.SelectedIndex =). Is there a similiar property for the Dropdown
list that I am just not seeing?

DropDownList.SelectedIndex = 0 does not seem to work.

Regards,
Kris
Nov 18 '05 #1
5 10790
What does not work about setting the list's selectedindex property?

On Sun, 11 Apr 2004 14:25:13 -0400, "Kris Rockwell"
<kr***************************@hybrid-learning.com> wrote:
Hello (again),

I have gotten the dropdown list functionality to work through a few tricks
(probably not the most efficient, but it works) but I am not sure how to set
the default selected value. I have tried setting various values to represent
the default value with little success. Essentially I am looking to have the
first item in the list be the default selected item. I noticed in the
properties for a dtat grid you could set a default selected index
(DataGrid.SelectedIndex =). Is there a similiar property for the Dropdown
list that I am just not seeing?

DropDownList.SelectedIndex = 0 does not seem to work.

Regards,
Kris


Nov 18 '05 #2
Well, it seems although I set the property as follows:

DropDownList.SelectedIndex = 0

the selected value is not passed. If I try to get the value after setting
this I no return (although I do see the associsted text in the DDList).
However, if I select a different value and then select the initial value it
does retuen the index.

Regards,
Kris

"Dan Brussee" <db******@nc.rr.com> wrote in message
news:m4********************************@4ax.com...
What does not work about setting the list's selectedindex property?

On Sun, 11 Apr 2004 14:25:13 -0400, "Kris Rockwell"
<kr***************************@hybrid-learning.com> wrote:
Hello (again),

I have gotten the dropdown list functionality to work through a few tricks(probably not the most efficient, but it works) but I am not sure how to setthe default selected value. I have tried setting various values to representthe default value with little success. Essentially I am looking to have thefirst item in the list be the default selected item. I noticed in the
properties for a dtat grid you could set a default selected index
(DataGrid.SelectedIndex =). Is there a similiar property for the Dropdown
list that I am just not seeing?

DropDownList.SelectedIndex = 0 does not seem to work.

Regards,
Kris

Nov 18 '05 #3
Just being sure. You mention checking the value. The SelectedValue is
quite different than the SelectedIndex. Setting the SelectedIndex to 0
will select the first item in the dropdown list. It will have both a
Value and Text property as well.
On Sun, 11 Apr 2004 18:29:17 -0400, "Kris Rockwell"
<kr***************************@hybrid-learning.com> wrote:
Well, it seems although I set the property as follows:

DropDownList.SelectedIndex = 0

the selected value is not passed. If I try to get the value after setting
this I no return (although I do see the associsted text in the DDList).
However, if I select a different value and then select the initial value it
does retuen the index.

Regards,
Kris

"Dan Brussee" <db******@nc.rr.com> wrote in message
news:m4********************************@4ax.com.. .
What does not work about setting the list's selectedindex property?

On Sun, 11 Apr 2004 14:25:13 -0400, "Kris Rockwell"
<kr***************************@hybrid-learning.com> wrote:
>Hello (again),
>
>I have gotten the dropdown list functionality to work through a fewtricks >(probably not the most efficient, but it works) but I am not sure how toset >the default selected value. I have tried setting various values torepresent >the default value with little success. Essentially I am looking to havethe >first item in the list be the default selected item. I noticed in the
>properties for a dtat grid you could set a default selected index
>(DataGrid.SelectedIndex =). Is there a similiar property for the Dropdown
>list that I am just not seeing?
>
>DropDownList.SelectedIndex = 0 does not seem to work.
>
>Regards,
>Kris
>


Nov 18 '05 #4
Following what you have said, setting the code as follows should produce the
correct results.

...Omitted Connection, data adapter and Dataset info...

DropDownList.DataBind()
DropDownList.SelectedIndex = 0

In this instance the first item in the list should be selected by default
without any user interaction.

Is that a correct assumption?

Regards,
Kris

"Dan Brussee" <db******@nc.rr.com> wrote in message
news:f8********************************@4ax.com...
Just being sure. You mention checking the value. The SelectedValue is
quite different than the SelectedIndex. Setting the SelectedIndex to 0
will select the first item in the dropdown list. It will have both a
Value and Text property as well.
On Sun, 11 Apr 2004 18:29:17 -0400, "Kris Rockwell"
<kr***************************@hybrid-learning.com> wrote:
Well, it seems although I set the property as follows:

DropDownList.SelectedIndex = 0

the selected value is not passed. If I try to get the value after setting
this I no return (although I do see the associsted text in the DDList).
However, if I select a different value and then select the initial value itdoes retuen the index.

Regards,
Kris

"Dan Brussee" <db******@nc.rr.com> wrote in message
news:m4********************************@4ax.com.. .
What does not work about setting the list's selectedindex property?

On Sun, 11 Apr 2004 14:25:13 -0400, "Kris Rockwell"
<kr***************************@hybrid-learning.com> wrote:

>Hello (again),
>
>I have gotten the dropdown list functionality to work through a few

tricks
>(probably not the most efficient, but it works) but I am not sure how to
set
>the default selected value. I have tried setting various values to

represent
>the default value with little success. Essentially I am looking to
havethe
>first item in the list be the default selected item. I noticed in the
>properties for a dtat grid you could set a default selected index
>(DataGrid.SelectedIndex =). Is there a similiar property for the

Dropdown >list that I am just not seeing?
>
>DropDownList.SelectedIndex = 0 does not seem to work.
>
>Regards,
>Kris
>

Nov 18 '05 #5
Looks right to me.

On Sun, 11 Apr 2004 22:01:58 -0400, "Kris Rockwell"
<kr***************************@hybrid-learning.com> wrote:
Following what you have said, setting the code as follows should produce the
correct results.

..Omitted Connection, data adapter and Dataset info...

DropDownList.DataBind()
DropDownList.SelectedIndex = 0

In this instance the first item in the list should be selected by default
without any user interaction.

Is that a correct assumption?

Regards,
Kris

"Dan Brussee" <db******@nc.rr.com> wrote in message
news:f8********************************@4ax.com.. .
Just being sure. You mention checking the value. The SelectedValue is
quite different than the SelectedIndex. Setting the SelectedIndex to 0
will select the first item in the dropdown list. It will have both a
Value and Text property as well.
On Sun, 11 Apr 2004 18:29:17 -0400, "Kris Rockwell"
<kr***************************@hybrid-learning.com> wrote:
>Well, it seems although I set the property as follows:
>
>DropDownList.SelectedIndex = 0
>
>the selected value is not passed. If I try to get the value after setting
>this I no return (although I do see the associsted text in the DDList).
>However, if I select a different value and then select the initial valueit >does retuen the index.
>
>Regards,
>Kris
>
>"Dan Brussee" <db******@nc.rr.com> wrote in message
>news:m4********************************@4ax.com.. .
>> What does not work about setting the list's selectedindex property?
>>
>> On Sun, 11 Apr 2004 14:25:13 -0400, "Kris Rockwell"
>> <kr***************************@hybrid-learning.com> wrote:
>>
>> >Hello (again),
>> >
>> >I have gotten the dropdown list functionality to work through a few
>tricks
>> >(probably not the most efficient, but it works) but I am not sure howto >set
>> >the default selected value. I have tried setting various values to
>represent
>> >the default value with little success. Essentially I am looking tohave >the
>> >first item in the list be the default selected item. I noticed in the
>> >properties for a dtat grid you could set a default selected index
>> >(DataGrid.SelectedIndex =). Is there a similiar property for theDropdown >> >list that I am just not seeing?
>> >
>> >DropDownList.SelectedIndex = 0 does not seem to work.
>> >
>> >Regards,
>> >Kris
>> >
>>
>


Nov 18 '05 #6

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

Similar topics

6
by: passion_to_be_free | last post by:
This is probably simple, but I can't seem to find it anywhere. I have have some values stored in javascript variables. I have a <select> dropdown list whose options correspond to these values. I...
5
by: Kris Rockwell | last post by:
Hello (again), I have gotten the dropdown list functionality to work through a few tricks (probably not the most efficient, but it works) but I am not sure how to set the default selected value....
6
by: Mark | last post by:
I have two dropdown lists. Both have autopostback set to true. In both dropdowns, when you select an item from the list, it redirects to the Value property of the dropdown. Nothing fancy. ...
6
by: Jenna Alten | last post by:
I have a datagrid with a template column that contains a dropdown list. I currently fill and display the dropdown list on the page load. This is working correctly. I am NOT using an Edit Column. I...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
0
by: cindy | last post by:
I have a dynamic datagrid. I have custom classes for the controls public class CreateEditItemTemplateDDL : ITemplate { DataTable dtBind; string strddlName; string strSelectedID; string...
6
by: yasodhai | last post by:
Hi, I used a dropdown control which is binded to a datagrid control. I passed the values to the dropdownlist from the database using a function as follows in the aspx itself. <asp:DropDownList...
4
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
5
by: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ== | last post by:
I have a VS 2008 ASP.NET webform that has a reportview tag on it, accessing an .RLDC report in local report. The columns for the report are essentially: Month Item #1 Item#2 Item#3 ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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
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,...
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
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.