473,387 Members | 1,528 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,387 software developers and data experts.

Very Easy Dropdownlist Problem

Hi Everyone,

How do you get two or more listitems to have the same value?

I am trying to do this:

<asp:dropdownlist id="one" runat="server">
<asp:listitem text="hello" value="hi" />
<asp:listitem text="yada" value="hi" />
<asp:listitem text="NO" value="die" />
</asp:dropdownlist>

If I select "yada", and submit the page, the page reloads by "hello" will be
selected. It happens whenever I want
two or more listitems to have the same values but differen't text. I am
doing this for an email alert kind of system..

The purpose of this program is to let a user select a product that they are
interested in. There are managers for the products.. When the user submits
the form, it will send an email the manager (who's email should be populated
in the 'value'). However, there is more than one product that each manager
is in charge of.

--
LUIS ESTEBAN VALENCIA
MICROSOFT DCE 3.
MIEMBRO ACTIVO DE ALIANZADEV
http://spaces.msn.com/members/extremed/
Nov 19 '05 #1
4 1612
in the Page_Load check for IsPostBack and iterate through the dropdownlist,
by text instead of value

--
Curt Christianson
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Luis Esteban Valencia" <lu*******@haceb.com> wrote in message
news:eo**************@TK2MSFTNGP15.phx.gbl...
Hi Everyone,

How do you get two or more listitems to have the same value?

I am trying to do this:

<asp:dropdownlist id="one" runat="server">
<asp:listitem text="hello" value="hi" />
<asp:listitem text="yada" value="hi" />
<asp:listitem text="NO" value="die" />
</asp:dropdownlist>

If I select "yada", and submit the page, the page reloads by "hello" will
be
selected. It happens whenever I want
two or more listitems to have the same values but differen't text. I am
doing this for an email alert kind of system..

The purpose of this program is to let a user select a product that they
are
interested in. There are managers for the products.. When the user
submits
the form, it will send an email the manager (who's email should be
populated
in the 'value'). However, there is more than one product that each
manager
is in charge of.

--
LUIS ESTEBAN VALENCIA
MICROSOFT DCE 3.
MIEMBRO ACTIVO DE ALIANZADEV
http://spaces.msn.com/members/extremed/

Nov 19 '05 #2
Oh... And with the massive number of posts you've put up I suggest you start
to use Google, or whatever search engine you like. Most of these issues are
easily found...

--
Curt Christianson
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Luis Esteban Valencia" <lu*******@haceb.com> wrote in message
news:eo**************@TK2MSFTNGP15.phx.gbl...
Hi Everyone,

How do you get two or more listitems to have the same value?

I am trying to do this:

<asp:dropdownlist id="one" runat="server">
<asp:listitem text="hello" value="hi" />
<asp:listitem text="yada" value="hi" />
<asp:listitem text="NO" value="die" />
</asp:dropdownlist>

If I select "yada", and submit the page, the page reloads by "hello" will
be
selected. It happens whenever I want
two or more listitems to have the same values but differen't text. I am
doing this for an email alert kind of system..

The purpose of this program is to let a user select a product that they
are
interested in. There are managers for the products.. When the user
submits
the form, it will send an email the manager (who's email should be
populated
in the 'value'). However, there is more than one product that each
manager
is in charge of.

--
LUIS ESTEBAN VALENCIA
MICROSOFT DCE 3.
MIEMBRO ACTIVO DE ALIANZADEV
http://spaces.msn.com/members/extremed/

Nov 19 '05 #3
Luis,

Your problem is probably due to the way ASP.NET reloads the viewstate info.
I think it sets the selected index using the Items.FindByValue() method.
This means that the first one it comes to that matches is hello.

My only suggestion at this point without looking to deep into it, is to
create a user control containing your dropdown but that repopulates when it
loads using FindByText instead, manky but all i can think of right now.

MattC

"Luis Esteban Valencia" <lu*******@haceb.com> wrote in message
news:eo**************@TK2MSFTNGP15.phx.gbl...
Hi Everyone,

How do you get two or more listitems to have the same value?

I am trying to do this:

<asp:dropdownlist id="one" runat="server">
<asp:listitem text="hello" value="hi" />
<asp:listitem text="yada" value="hi" />
<asp:listitem text="NO" value="die" />
</asp:dropdownlist>

If I select "yada", and submit the page, the page reloads by "hello" will
be
selected. It happens whenever I want
two or more listitems to have the same values but differen't text. I am
doing this for an email alert kind of system..

The purpose of this program is to let a user select a product that they
are
interested in. There are managers for the products.. When the user
submits
the form, it will send an email the manager (who's email should be
populated
in the 'value'). However, there is more than one product that each
manager
is in charge of.

--
LUIS ESTEBAN VALENCIA
MICROSOFT DCE 3.
MIEMBRO ACTIVO DE ALIANZADEV
http://spaces.msn.com/members/extremed/

Nov 19 '05 #4
See the other thread for things that works...

Now I would rather consider that " value" shoudl be the unique id for the
corresponding text.

I would do this this way (granted more complicated but likely more general)
:
- the text is the product description, the valuie is the product id
(unique).

You know then server side by its id whic product where selected allowing to
get the correspoing managed and whatever else information you would need to
create the mail...

Patrice

--

"Luis Esteban Valencia" <lu*******@haceb.com> a écrit dans le message de
news:eo**************@TK2MSFTNGP15.phx.gbl...
Hi Everyone,

How do you get two or more listitems to have the same value?

I am trying to do this:

<asp:dropdownlist id="one" runat="server">
<asp:listitem text="hello" value="hi" />
<asp:listitem text="yada" value="hi" />
<asp:listitem text="NO" value="die" />
</asp:dropdownlist>

If I select "yada", and submit the page, the page reloads by "hello" will be selected. It happens whenever I want
two or more listitems to have the same values but differen't text. I am
doing this for an email alert kind of system..

The purpose of this program is to let a user select a product that they are interested in. There are managers for the products.. When the user submits the form, it will send an email the manager (who's email should be populated in the 'value'). However, there is more than one product that each manager is in charge of.

--
LUIS ESTEBAN VALENCIA
MICROSOFT DCE 3.
MIEMBRO ACTIVO DE ALIANZADEV
http://spaces.msn.com/members/extremed/

Nov 19 '05 #5

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

Similar topics

12
by: Stanley J Mroczek | last post by:
How do you load a dropdownlist when edit is clicked in a datagrid ? <Columns> <asp:BoundColumn DataField="OptionDescription" ItemStyle-Wrap="True" HeaderText="Option...
1
by: Antonio D'Ottavio | last post by:
Good morning, I've a problem with a dropdownlist located inside any row of a datalist, I fill both datalist and dropdownlist at runtime, the problem is with the dropdownlist infact using the event...
1
by: HoustonFreeways | last post by:
I am populating a dropdownlist via a databind to a database. However, the text to be displayed can be very long, making the dropdownlist very wide. I need some way to reduce the width of the...
4
by: Mark Waser | last post by:
I've discovered a very odd bug when attempting to put a dropdown list in a datagrid. In the page PreRender step, the selected index of the datagrid is successfully set during databinding. Yet,...
0
by: Juanjo | last post by:
Hi, Before, I was working with Asp.net 1.0 and datagrid. I posted a question for this issue. The solution of this problem is load the second dropdownlist on the selectedindexchanged event of the...
9
by: Elliot Rodriguez | last post by:
WinXP Pro Let me preface this by saying I have developed with the .NET IDE since its release, and I consider myself reasonably savvy with it. I have a medium sized form with about 120 controls...
3
by: Lohboy | last post by:
Using ASP.NET and IE7. (Sorry if I am posting in the wrong forum but my problem seemed to be more related to the JavaScript side than the ASP.NET side.) I have two DropDownList controls the...
1
by: Brett | last post by:
I have a DropDownList in an ASP.NET web form that is populated with items from a lookup table by binding that DropDownList to a SqlDataSource. However, the items in the lookup table can change over...
6
by: shashi shekhar singh | last post by:
Respected Sir, I have to create multiple dynamic dropdownlist boxes and add items dynamically in <asp:table> server control but problem occurs , i.e. except of fist dropdown list no dropdownlist...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...

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.