adding values to the selected value in Dropdown list


   I have dropdown box in my page which have some value inherted from the another list box in my page..

Now in my second page , i have dropdown box with values and text value and list box...

I'll be selecting the one value from the dropdown then i enter the value in text box and click on add button which will add the value in the list box like this i can able to add many if i click on save button for the selected dropdpown item the added values in the listbox should be saved this i add many values for many dropdown item and saved respectively

now if choose the any dropdown the values added for the particular item should be displayed...

 How can i code it, please share the code in C# ..since i'm not aware of any coding standard since i'm a beginner..




4/8/2009 2:45:05 PM 93655 articles. 5 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 56

Hi Man,,,,
try this,,,,,
list.Items.add(new ListItem(text,value));
4/8/2009 3:38:16 PM

Hi try this

             ListItem items = new ListItem("shopping", "1");



List.Items.Insert(0, new ListItem("shopping", "0"));

Mark as Answer the Post That Solves the problem. Because It helps others to find the solution.

José Luis Rodríguez V.
4/8/2009 4:28:21 PM


    i tried above 2 codes bt it was not mentioned above i tried for 2 code

    but error is displayed in the List.items.add(items)

    do i want to import any namespace to use this line...

please help me out..


4/16/2009 1:13:43 PM



    i tried above 2 codes bt it was not mentioned above i tried for 2 code

    but error is displayed in the List.items.add(items)

    do i want to import any namespace to use this line...

please help me out..



what it is error?

Mark as Answer the Post That Solves the problem. Because It helps others to find the solution.

José Luis Rodríguez V.
4/16/2009 5:20:55 PM

Similar Artilces:

Drop down list in Form view returns error when value in bound field (data binding
I get the following error when I click edit to edit the details in the web form:'ddlUserRestrictionType' has a SelectedValue which is invalid because it does not exist in the list of items.Parameter name: value  I would like it to accept any value which currently exists in the database. Is this easily achievable? With what you've posted, all I can tell is that you are trying to set the SelectedValue of a ddl to a value that does not exist in the list.  It would be helpful if you can post some code and the expected values of this control.~ Timwww.bucketo...

Cascading Dropdown List
Hi, First post so hello and need some help with an issue I have been dealing with.  I have an intranet page I created in ASP.NET using C# .NET 3.5 with a few Ajax Extenders including 3 Cascading Dropdown Lists. Now I have used the Cascading dropdown lists for my own purposes i.e they do not actually cascade their results to another dropdown list, the reason I did this was due to the having a User Control that contains an update panel and other bits i.e I didn't want the control/page posting page (something that happens when you click on a regular dropdown list). Everything is wor...

Dropdownlist selected value passes first value in list no matter what value is selected. why ?
 HI . I have a dropdownlist. Databinds ok but when I must pass a value as a Selected value it always passes the first value in the list even if I select another value. I tried to set the ddl to enableviewstate false but it doesn't change anything. Any ideas ? Code below, thanksLoading the ddl:       productCategories = CatalogAdmin.Admin_Product_Categories_NotIn(productId);        for (int i = 0; i < productCategories.Rows.Count; i++)        {       &...

How to show value in textbox from selected value in Dropdown list
I have two text box, txtbox1 should be from two field for example i have one dropdownlist where i select item and another txtbox2 i want to put value, when i first time to write manually value in txtbox2 in and selected item from ddl i want to result in concatenate from in txtbox1. for example  I haveif not me.ispostback thenDim cm as new sqlcommand("Select AccMjrid, Names from Accgrp",, "Accgrp") Me.cmbAccMajID.DataSource = Me.DataSet11.Tables("AccMajor") Me.cmbAccMajID.DataTextField = "AccName" Me.cmbAccMajID.DataValueField ...

DropDown list submits first value not the selected value
I am relatively new to programming and am having a problem with a small project that I am working on.  I have a names drop down list that is created from a database.  When the user selects a name and completes the rest of the form and clicks submit.  All of the data they entered is submitted to a different table in that database.  This is workign correctly for all of the data except the drop down.  For some reason the first value in the drop down is being submitted each time.  Here is the code and any help you can give will be appreciated. Public Class final1 ...

dropdown selected value and dropdown no value saved
 is there any way the selected value is selected already when i try to edit the gridview ... and another thing... when i edit this dropdown.. no value was being saved... what is wrong or missing.. please help... i almost spend two days on this problem...i've read many post about this.. but still i didn;t get it... please help///  <asp:TemplateField HeaderText="Unit" SortExpression="UnitID">                          &...

can i drag the selected value of dropdown list in one web part to another web part
hi, supose i am having time displaying in on webpart can i drag the value of time to another web part and and display the time is: and the value draged from the other webpart so i want to drag the value year and population into antoher web part and according to that the grap must appear i.e what  i exactly want is i must drag some value from one webpart to onother webpart and according to event some thing must happen in another web part   Hi, The problem has been replied in the following post: But from the title you described, do ...

Populate dropdown list based on selected value in another dropdown list
I have a datagrid (grdCar) that contains two dropdown listboxes (ddlCarManf and ddlCar). When the user clicks the "Edit" link and places the grid into edit mode, they select a value in ddlCarManf. Based on the selected value in ddlCarManf, I need to then populate ddlCar with a list of cars for which the selected manufacturer makes (I'm using ddlCarManf.SelectedValue to query the database).  I bind my datagrid in the page_load event as: If Not Page.IsPostBack Then    BindGrid() End If Here is my control (ddlCarManf) as is appears within grdCar in ...

Displaying values from 3 textboxes automatically after selecting a value from a dropdown list
 The dropdown list is databind to a sqldatasource from the Bike Table.After selecting a bike Name from the dropdown list, the status and rent price will be displayed on the 2 textboxes automatically.Both the status and  rent price values are taken from the same Bike Table.Can anyone help me with this?Thanks. On the selected index change property of the dropdownlist hit the database to get the details (status and rent ) for the selected Item and set the values to the text of textboxes.Hope this helps. Just do this in your OnSelectedIndexChanged event of the ddlSqlCommand cmd =...

Password text value gets deleted when value selected from Dropdown list
Hi, I need help in my dropdown control, this is what my problem is I am using DropDown List in my aplication in a form and i want to show some default selected value in the first drop down D1 and depending on values selected in D1 the values gets displayed in the child drop down D2. My issue is i have a password texbox before getting valued from D1 and D2......when i select value from D1 the password enetered in hte password textbox in password mode gets deleted. so every time he user types the password and then select something in the dropdown, he has to ...

changing the selected value for the dropdown list to match a query string value
My url looks something like this " and on that page I want the dropdownlist selected value to show up as cheatcountry automatically if that is what the query string is. How do i do this? Hi, QueryStrings can't be read via javascript. If your select box (combo box) is a html control and not DropDownList server control. You do a normal static variable to set the selected property in the combo box to this variable. You then use the server side to read the query string and pass the selected value to this j...

hide only the dropdown value while selecting the another dropdown value
 hai  friend i am using two dropdown list if i select one dropdownlist the another dropdownlist value must be hidewhat can i do for this     Ramesh.D  u can do that using javascript..function Hide(){ var drop1 = document.getElementById('<%=dropdownlist1.ClientID%>')  var drop2 = document.getElementById('<%=dropdownlist2.ClientID%>')  if(...

I want to display textbox on changing value of dropdownlist or selected value of dropdown list.How could i?
for example i have taken field PF%,PF($)  in dropdown.Onselected value of % i will show textbox.In which u can fill  the value of PF% based on that calulation will be shown in other textbox. But how can i do thta? Not too sure I undertand your question, but if you want to show/hide elements here's a few things you might want to try: You can set the dropdown's autopostback to true and perform all sorts of wonderful serverside stuff, including adding a textbox control (with a certain value) to a container div. If you want to keep things light then use some CSS and ...

populating the dropdown list with the values from the data base, Failing near adding the values todropdown
Here is My code' .aspx &nbsp;<asp:DropDownList ID="ddlkeyword" runat="server" Width="204px" >   </asp:DropDownList></td>   .aspx.cs   page_load() { fillddlkeyword(); }private void fillddlkeyword() {string StrSql = "Select distinct(formName)as formName from tbl_form"; oDB.RunDBQuery(StrSql, out oRS);DataTable dt = new DataTable(); dt.Columns.Add("Form");if (oRS.HasRows) {while (oRS.Read()) {DataRow dr = dt.NewRow(); dr["Form"] = oRS["formName"].ToString(); &n...

Web resources about - adding values to the selected value in Dropdown list -

Portal:Law/Nominate/Selected article - Wikipedia, the free encyclopedia
Add the article in to a subpage of this portal, such as Portal:Law/Selected article/# , replacing the "#" with the number above the current highest. ...

F8: Facebook’s FbStart Initiative Will Give Selected Developers A $30K Kick-Start
... successful applications is likely a whole lot easier with $30,000 in free tools and services to start off with, and that’s exactly what selected ...

LEGO Shop - The LEGO Technic team has selected the winner... - Facebook
The LEGO Technic team has selected the winner of the Co-Creation Challenge! LEGO will be producing a limited run of 20,000 of this stunning set.... ...

baby365- Grand Doctor Ma Selected Students for iPad on the iTunes App Store
Get baby365- Grand Doctor Ma Selected Students on the App Store. See screenshots and ratings, and read customer reviews.

Selected Cheney Vice Presidential Photographs
... for photos found within these albums are Paul Morse, Karen Ballard, Kimberlee Hewitt, Shealah Craighead, and Chris Greenberg. These selected ...

[iOS Advice] How To Clarify Your Email Replies By Quoting Selected Text - YouTube
Follow me on Twitter: Like my Facebook page: RATE, COMMENT, SUBSCRIBE! :-) ...

Local farmers to sell their fresh dates at selected supermarkets
Fresh dates will be on sale this summer under the label of Local Harvest at selected supermarkets and Spinney's.

Animal of the Day: Lucius Has Been Selected as the U.K.’s ‘Happiest Cat’
He’s got one blue eye, one green eye and a heart of gold. British mobile phone company O2 recently held some “cat auditions” to find “the UK’s ...

Michael Sam becomes first openly gay player selected in an NFL Draft
Defensive end Michael Sam of the University of Missouri became the first openly gay player to be selected in a National Football League Draft ...

Artist facing child pornography charges selected for MCA exhibition
An artist facing child pornography charges has been selected to show work in a prestigious exhibition at the Museum of Contemporary Art Australia. ...

Resources last updated: 2/5/2016 5:55:07 AM