473,503 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10797
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
3450
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
525
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
10653
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
5384
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
4530
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
2895
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
5836
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
4560
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
10321
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
7203
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,...
1
6993
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...
0
7462
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
5579
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,...
0
4675
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...
0
3168
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...
0
1514
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 ...
1
737
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
383
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...

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.