Forms Data Controls :: Select Multiple Items In A Dropdownlist

Jan 11, 2011

i need to select multiple items in a dropdownlist. This is my code,

<asp:DropDownList ID="ddllocation" runat="server" Width="80px">
<asp:ListItem>Chennai</asp:ListItem>
<asp:ListItem>Madurai</asp:ListItem>
<asp:ListItem>Coimbatore</asp:ListItem>
<asp:ListItem>Nilgiris</asp:ListItem>
<asp:ListItem>Palaghat</asp:ListItem>
</asp:DropDownList>

How can i add tat option.

View 7 Replies


Similar Messages:

Select Multiple Items From DropDownList Into TextBox - No Duplicates

Dec 7, 2010

i used the following technique to Select multiple items from DropDownList into TextBox with No duplicates, however i dont think it is the most proper way, any ideas. pressing again with same value selected choose another value from DDL and press button

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextBox2.Text.Contains(DropDownList1.SelectedItem.Text) Then
Dim m As New Label
m.Text = "duplicate !"
Me.form1.Controls.Add(m)
Exit Sub
End If
If TextBox2.Text = "" Then
TextBox2.Text = DropDownList1.SelectedItem.Text
Else
TextBox2.Text = TextBox2.Text + " , " + DropDownList1.SelectedItem.Text
End If
End Sub

View 1 Replies

Forms Data Controls :: Select The Multiple Items In The Listbox?

Aug 14, 2010

I want to select the multiple items in the listbox.....for eg in my listbox there are five items

apple,pear,lotus,red,blue.on button click i want to select two items from the listbox.

How to do....

View 6 Replies

Forms Data Controls :: Unable To Get Multiple Items Selected In A DropDownList Exception?

Jul 21, 2010

I am trying to hide 2 buttons depending on the value in the dropdownlist. It works when the page is initially loaded but chokes when returning to the page sometimes. I have some pretty simple code in the Page_Load event within an If Not Page.IsPostBack statement

[Code]....
[Code]....

View 2 Replies

.net - Partial Postback .NET 1.1 - Select Multiple Items Then Data Is Updated?

Jun 7, 2010

I have a ASP.NET 1.1 web application page which is built with .net framework 1.1 and in GridView the data is displayed.I want when they select multiple items then data is updated but without the complete postback of the page.

View 1 Replies

Data Controls :: Bind And Populate Multiple Select (MultiSelect) DropDownList With CheckBoxes From Database Using JQuery

May 7, 2015

I am refering below url:

[URL]

how to select items in dropdownlist if i bind it from database.

Once i select some items and save in database , after that i want items selected when page reloads that items bind in dropdown.

View 1 Replies

Web Forms :: Select Multiple Items In Listbox?

Feb 16, 2010

I'm using a listbox to save multiple selected value in db. I'm saving that values by seperating comma(,). In edit option i want to reterive the same value from db and want show multiple selected items in listbox.

View 9 Replies

Web Forms :: Cannot Have Multiple Items Selected In A DropDownList

May 7, 2015

System.Web.HttpException: Cannot have multiple items selected in a DropDownList.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Cannot have multiple items selected in a DropDownList.

I have a nested gridview and inisde a child grid there are several columns having dropdown and one add button. when add button is click a new row inside a child grid is created with an empty dataand previous row data have been saved in viewstate so that it can be bind wen add button is click to create new rows.My code is working fine when i dont select any dropdown list item and new row is also created but wen i select items from dropdown and click on add more button i get above error.

When add button is click

protected void ButtonAdd_Click(object sender, EventArgs e) {
Button gv = ((sender) as Button);
string[] ParentIdArray = gv.ClientID.ToString().Split('_');
int ParentId = int.Parse(ParentIdArray[1].ToString().Replace("ctl", "").Trim()) - 2;
int RecordCount = ((GridView)GVMain.Rows[ParentId].FindControl("grdAddHotel")).Rows.Count;

DataTable dtAddHotel = new DataTable();
dtAddHotel.Columns.Add("CostSheetId");

[Code] .....

View 1 Replies

DataSource Controls :: Select Statement By Multiple Dropdownlist

Feb 25, 2010

if I have three Dropdownlist A, B, C, how can I write a select statement to get data from sql server based on the dropdownlist selected.e.g. if user select dropdownlist A, select * from table where A = dropdownlist A but if user select dropdownlist A and C, then select statment is "select * from table where A = dropdownlist A and B = dropdownlist B or if selected A, B, C.......how can I settle so many choice.

View 2 Replies

Web Forms :: Getting Error / Cannot Have Multiple Items Selected In A DropDownList

May 29, 2010

Below is my code. I am getting error "Cannot have multiple items selected in a DropDownList"

if i run this code.lstType.Items.Clear()

strSql = ""
lstType.DataSource = handler.fnDataSet(strSql)
lstType.DataBind() [code]....

View 12 Replies

Web Forms :: Unable To Have Multiple Items Selected In A DropDownList?

May 31, 2010

I have just started with this . I am a new user and i want to know that why we cannot have multiple items selected in a DropDownList?

View 4 Replies

Forms Data Controls :: How To Select Multiple Records In A Gridview Over Multiple Pages

Jan 14, 2011

I have an inventory page with a gridview that shows 1 item per record, each item starts with a checkbox in the gridview. Currently users can select multiple records and hit the order button and everything has worked well. Now I have multiple pages in my gridview, and if a user selects a few records from the first page, and then goes to the second page, all the records (checked checkboxes) disappear from the first page.

[Code]....

View 8 Replies

C# - Select Multiple Items In Listbox From Code?

Dec 9, 2010

I have two databound listboxes. The first only shows items that have been assigned to my product. The second listbox shows all available items. What I want to do is select all of the items in listbox 2 that list box one contains.

For example:
ListBox1-
Item 1
Item 3
ListBox2-
Item 1 (Selected)
Item 2
Item 3 (Selected)

Code I have:

List<string> myList = new List<string>();
foreach(ListItem f in ListBoxSourceDetail.Items)
{
myList.Add(f.Value);
}
myList.ForEach(delegate(string n)
{
ListBoxSourceEdit.SelectedValue = n;
});

View 1 Replies

Web Forms :: Select Multiple Fields From A Dropdownlist?

Sep 6, 2010

How to select multiple fields from a dropdownlist..

View 6 Replies

WebMatrix :: Html.ListBox Cannot Select Multiple Items?

Nov 10, 2010

I'm trying to use the ListBox html helper in a simple form.

verhuurPrijzenLst is a simple list that gets put into the ListBox, I think I need "MultiSelectList", but I cannot use it (MVC framework needed)?

I don't know exactly how to do that ( bin folder and @inherits ? )

So it's nice to have a helper at hand, but if you cannot use it properly without using the MVC framework, that is a pity.

[Code]....

View 4 Replies

Web Forms :: Multiple Select (MultiSelect) DropDownList With CheckBoxes?

Nov 22, 2015

Multiple Select (MultiSelect) DropDownList with CheckBoxes in ASP.Net using jQuery. But i want save to database several selected value dropdownlist.

View 1 Replies

Forms Data Controls :: How To Add New Items From Dropdownlist

Nov 18, 2010

I have a dropdownlist which get item from database (say this field has 10 records for this dropdown list.

I want the users are not restricted to these 10 items. What is the quickest way to do so the user can type in new values and insert into database ?

View 4 Replies

Forms Data Controls :: When Select Items From Second Dependent Dropdown Does The Grid Display Data

Jun 8, 2010

Iam trying to understand why my sqldatasource control bound to gridview will not return data while i have cascading dropdownlist coded in pageload and selected events respectively?

from which sqldatasource control stored procedure obtains its parameter values.

only when i select items from second dependent dropdown does the grid display data?

View 10 Replies

Forms Data Controls :: Check If Dropdownlist Has Any Items?

Nov 18, 2010

I have a DropDownList with a list of orders. When an order is selected from the list I generate a GridView with details of that order. Within the GridView I call other databound controls and all works fine until I finish the orders in the DropDownList

I have tried to enclose the code within a if dropdownlist.items isnot nothing end if but it makes no difference

This is the code:

Protected Sub GridView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.DataBound
If DropDownList1.Items IsNot Nothing Then
GridView1.SelectedIndex = 0 [code]...

View 2 Replies

Forms Data Controls :: Reload Items In Dropdownlist?

Jun 22, 2010

i have dropdownlist. After i loaded data from javascript to dropdownlist,i used dropdownlist.item.count but counter always null. how to refresh dropdownlist?

View 5 Replies

Forms Data Controls :: Cannot Add Items To A Dropdownlist Within A LoginView Control

Mar 25, 2011

I have a Dropdownlist within a LoginView Control as follows:

[Code]....

And in my code behind I can successfully reference the dropdownlist as follows:

[Code]....

However as soon as I try to add an item to the dropdownlist it all falls apart: The (pseudo) code to add an item is:

[Code]....

The error I get is:

[Code]....

View 5 Replies

Forms Data Controls :: How To Populate Dropdownlist Whit Items In Listview

May 24, 2010

In my project I have a listview which I am binding from code behind. Now I would like to add a droppdownlist for each item in listview. So my question would be:

Is there a way to populate my dropdownlist whit data which I have in a List?

Here is a bit of code to show how my listview looks like:

[Code]....

View 2 Replies

Forms Data Controls :: DropDownList In The FooterTemplate Of A DataGrid Will Not Show Its Items?

Oct 13, 2010

I am placing a dropdown list in the footer of a DataGrid like this:

[Code]....

In my code behind file, in the myDDL_OnLoad event handler, I call to the database, populate a SqlDataReader, and set the DDL's datasource to that datareader. I define what data columns should be used for the DataValueField and DataTextField of the dropdownlist. Then I call the DropDownList's DataBind() method. Everything works without error. But, when the dropdownlist is displayed, it has blank lines in it.

By that, I mean if 8 records are loaded into the dropdownlist, it will expand to a size appropriate for 8 rows but, it will be empty. there is no text in it.

Has anyone seen this type of behavior before? This dropdownlist is in the footer of a dynamically loaded ajax update panel so, it is difficult to see the source code to see what values are in the html element rendered to represent the dropdown.

View 1 Replies

Forms Data Controls :: DropDownList DataBind; Appends Instead Renew Items?

Apr 9, 2010

environment: VS2008 When running below code the DDLKlient.DataBind() appends the whole set of names to the already existing list. I.e. I have 2 sets of names in the DropDownList!Question:? what can I do to prevent appending and just get 1 (one) set of names?? is there any refresh option?

Protected Sub DVKlient_ItemInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertedEventArgs) Handles DVKlient.ItemInserted
Dim connString As String

[code]...

View 2 Replies

Forms Data Controls :: Insert Multiple Items From A ListBox?

May 8, 2010

I have two ListBoxes. I can move items from one list box to the other. I have an Insertcommand for inserting added values from the "ActivePrograms" list box to a db.

my problem is that it inserts only one item when sometimes the user added multiple items.

how do I insert all existing items from "ActivePrograms" list box?:

second issue: how do I make sure the insert command go through the list of items in the listbox and makes sure these rows does mot already exsited in the db? in other words insert only NEW values for that 'Id' value

[Code]....

View 8 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved