Listbox Multi Selected Value

I am trying to get the values selected in a list box on my web form; and use these value in an sql statement.

I have done this within a windows form but i am struggling to work out how to achieve this in a web form; the windows form commands are not liked in the asp!!! 

Any help or advice would be appreciated.

7/30/2007 1:42:30 PM 93655 articles. 6 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 12

here is a small example function 

    protected void Button1_Click(object sender, EventArgs e)
        int count = ListBox1.Items.Count;

        for (int i = 0; i < count; i++)
            if (ListBox1.Items[i].Selected == true)
                //This is where you get each string, here I will just put into a textbox
                txtOutput.Text += ListBox1.Items[i].Text;
Please remember to click "Mark as Answer" on this post if it helped you.
7/30/2007 2:03:04 PM

Similar Artilces:

Using selected values from a Multi Select Listbox in a SQL query
I have seen a few post concerning this but don't really understand fully as I am new to this.  I would appreciate any help 1) First I loop through the Listbox control and get the selected values: Dim li As ListItemFor Each li In lbPClass.Items If li.Selected = True Then strPC += li.Value & ", " End If Next Label5.Text = strPC The resulting string looks something like: 101, 102, 100 ,    I get rid of the last space and "," with the following statement Label6.Text = Left(Label5.Text, Trim(Len(Label5.Text) - 2)) 2) I would then like to ...

Passing Values from a Web Form to Another Web Form
Hello All! I am trying to pass values from one web form to another web form. I know that there are 3 ways of doing this: queryString, Server.Transfer and Session. I am using the Server.Transfer method. But I am not able to create, in my 2nd web form, an instance of my 1st web form. My 1st Web form is named CallTrack.aspx and my 2nd is named Export.aspx. What I mean is something like this: Public value as CallTrack. I can't create it in my 2nd web form because when the intellisense is displayed, there's no CallTrack in the options. Thanks!   How about using cross-...

value of multi select listbox
Hey Guys, I have 2 listboxes on a page used for adding and removing from an available list to a selected list. I have the value property of my available list set to id's from a database. When i select multiple items at the same time from listbox 1 and move them to listbox 2, i am always getting the same value for all of the items in listbox 2. Whats worse is that instead of getting the datavaluefield, i get the index of listbox 1 as the value field. For example: I choose items 2,3,5 from listbox 1 and when they are moved to listbox 2, my item.value is always 2 instead of having...

Get listbox value from the other web form
 Dear all, I want to get the lisbox selecteditem value to a textbox in one web form from the other web page. Should I use session to get this value?Can any one help in this regard? Thanks a lot in advance.  People Develop People Yes you can use Session to get the informations between cross pages.. see below for your referenceTO STORE THE INFO in Session Session["key"] = ListBox1.SelectedItem.Value; Response.Redirect("Page2.aspx");TO GET THE VALUES FROM Sessionprotected void Page_Load(object sender, EventArgs e){    if (Sessio...

listbox selected value in
hi All, i had two listbox's side by side, i am loading items into listbox1 when the page is loaded, i am moving a item from listbox1 to listbox2 by using javascript. i want to populate listbox3 based on the listbox2 item, with out submiting the form, how can i get the listbox2 item in code behind file. can any one help me. thanks,        are you saying you want the selected item in listbox2 copied to listbox3 without a postback? If this is the case you could use javascript and the DOM to achieve this. Please Remember to click "Mark as Answer" o...

On selecting value in second listbox. selected value in first textbox is lost
     Hello all, In a webapplication , I have to store the selected values in hidden fields with following code  <INPUT type="hidden" name="hidPatient" value=""> <INPUT type="hidden" name="hidPatientStatus" value="">  when i select the value in any list box following javascript function is called with this code   Response.Write "<SELECT id=" & strSelName & " name=" & strSelName & " validation=" & strValidation & " ...

Implementing .Net Form into an web form, can this be done
I am new here, but have been searching for a while, and may not have the correct lingo to find what I am looking for.  I am tasked with implementing a .exe application that was writen vb6 then converted to .net into a new website my team is developing. The idea is to put each of the 3 different forms in this .exe application of 3 different .aspx pages. I have attempted multiple things to get this into the page and even started to just rewrite it as an web form, but even then I can't reuse any of the code since the System.Web.UI.Page doesn't inherit the sa...

Multi-select ListBox and Select All
Hi,I'm having an issue with some JS code for IE6 (no need for x-browser) and multi-select listbox.I'm trying to implement a Select All button.Current code is : function SelectAll(obj){ for (var i = 0; i < obj.options.length; i++) { obj.options[i].selected = true; } } which logically seems to work.  The problem I have is that this does not seem to work until I click the multi-select again.  It seems that although the options are marked as selected, the screen does not update to reflect this until something triggers it (in this case trying to click in ...

passing values to .net web form application
Hi Can any explain me abt how to pass values to my .NET web form application (designed using PB 11.1) from other web application? My intension is to redirect from a web application (ASP.NET to .net web form application) to my web application with user information. Thanks & Regards, Anbazhagan From the "Deploying Applications and Components to .NET" manual: >>> Starting an application with command line parameters If your application requires command line parameters, you can assign values to the PBCommandParm global property before you deploy the...

Return ListBox (Multiple) values from pop up child (javascript:ShowWindow) form listbox to parent form
Please advice me, how to get selected (multiple) values from a child pop up form constists of list box of available options back to parent window list box. I am not very familiar with this concept, please help me. If you have any URL or code samples send it to me. Thanks for your help. you would need to use javascript and send it by query string. I don't have the syntax right now as I am working on a similar problem myself. If I get it going soon I will post it....

Getting a listbox to show the value selected from a posted form
I have a form with a Listbox on it. How do I get the form returned from the post action with the selected data in the listbox. Also what is the difference between a listbox and a dropdownlistbox ? A Listbox shows more than one item, visibly, at a time - - - A DropDownList shows only one item - - you must click on it, so it will 'Drop Down' and show you other items in the list. Check out: David WierMCP/ - where to look first!Please Vote for ASPNet101 - 'Best Community Resource...

Selecting multiple value from Listbox control in web page
I have a search web page which has one textbox, listitem, search button and datagrid.1) How can i select multiple value in the listbox control. (Either by using Ctrl or shift key)2) After selecting multiple value from the listbox, how can i use those selected value to find the results in search query.Ex. My query is: select * from table where name = @Name@Name = All selected value from listbox control.Thanks Dim iCnt as Integer = myListBox.Items.Count For i = 0 To iCnt - 1 If myListBox.Items(i).Selected Then'Do something here End If NextHope it helpsZath Set the SelectionMode ...

Update selected RadioButtonList value to a label in a web form
 I have a web form and when you click a button, a ModalPopUp-control opens. It contains a RadioButtonList. All I want is that when user selects one of the RadioButtons in ModalPopup, it's value is updated back to a web form (label-control) using codebehind.  When I click the Update-button on the ModalPopup, the correct value (RadioButtonList's SelectedItem.Text) is passed and set to label's text-property, but label remains empty on the web form so it won't update.  Anyone, please? Hi k000der, From your description, I understand that you use the ModalPopupE...

Load Text box of one web form with selected list item of list box of another web form
one help please Problem is i have two web forms  1.  ForiegnkeyTest.aspx  2. foroginkeytable.aspx   step 1 1 ForiegnkeyTest.aspx one web form <head runat="server"><script language="javascript" type="text/javascript">   function popWin()   {         var confirmWin = null;      confirmWin ='foroginkeytable.aspx','anycontent',   'width=455,height=435,status');   }  </script> &...

Web resources about - Listbox Multi Selected Value -

Portal:Bollywood/Selected biography - Wikipedia, the free encyclopedia
Write three or four paragraphs in the text field using information from the selected notable article, you may find it useful to examine the existing ...

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.... ...

Grand Doctor Ma Selected Students-baby365 on the App Store on iTunes
Get Grand Doctor Ma Selected Students-baby365 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! :-) ...

UAE Under-19 cricketers for ACC Premier League tour of Malaysia selected - The National
Coach Aaqib Javed seeking fresh blood for senior team after missing out on World Twenty20

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 ...

Boyd Cordner selected for Kangaroos squad
Sydney Roosters stars Michael Jennings and Boyd Cordner have capped a grand-final win with selection in the Australian squad for the World Cup ...

Redlands LNP branch blood-letting after Matt McEachan pre-selected
There was more blood-letting in the seat of Redlands on the weekend when a motorcycle instructor was named LNP candidate for the embattled electorate ...

Resources last updated: 12/6/2015 10:34:20 PM