-
Feb 1st, 2012, 01:05 PM
#1
Curious about multiselect behavior
The multiselect Listbox seems to work in an odd way in ASP.NET. In a Windows Forms app, a Listbox in multiselect allows for the ready selection of multiple items by clicking on them. In the ASP.NET version, it appears that the listbox only allows multi-selection by holding down the Ctrl or Shift keys. Am I missing something? And if not, can anybody tell me why there is this difference?
My usual boring signature: Nothing
-
Feb 1st, 2012, 02:04 PM
#2
Member
Re: Curious about multiselect behavior
The default for ListSelectionMode is set to single, you have to set it to multiple in order to get or set multiple selections.
http://msdn.microsoft.com/en-us/libr...(v=vs.80).aspx
for windows forms, default is set to one, maybe in the apps you use the default has been changed, not really sure as I am not all that familar with Window Apps
Last edited by jdogg; Feb 1st, 2012 at 02:09 PM.
Reason: Added info
-
Feb 1st, 2012, 02:10 PM
#3
Member
Re: Curious about multiselect behavior
Oh sorry I misread the fact you said a listbox in multiselect, so the listbox has been set to allow multiple selections already, well at least that is how i understand it
-
Feb 1st, 2012, 02:37 PM
#4
Re: Curious about multiselect behavior
Hey Shaggy,
This is one of those situations where it "works as intended". The default action is for the ListBox to only do multi select when you first hold down CTRL.
There are ways around this:
http://josephschrag.blogspot.com/201...istbox-do.html
But you might want to look into other options, i.e. 3rd party controls, before going down this type of route.
Gary
-
Feb 1st, 2012, 03:30 PM
#5
Re: Curious about multiselect behavior
Yeah, I actually found a very nice looking 3rd party control, and might very well go that route (actually, the whole thing isn't up to me). I also see that this is "as intended", yet the difference between the way the multi-select listbox works in a Forms app and an ASP app is pretty peculiar. I actually had to go back to try out a multiselect winforms listbox just to be sure I wasn't hallucinating, but I wasn't.
What I'm curious about is whether or not there is some fundamental reason why MS decided to do this odd thing? Frankly, the winforms listbox works in a much more friendly way, so why change it for ASP unless it was necessary? Was it necessary, and if so, why?
My usual boring signature: Nothing
-
Feb 1st, 2012, 03:36 PM
#6
Re: Curious about multiselect behavior
Hello,
On that note, it is difficult to say.
It could be something to do with the way AutoPostBack's are implemented, or, more likely a limitation of the HTML rendering of a ListBox.
Remember, an ASP.Net Listbox renders as an HTML select element, so it isn't a simple Win Forms Control to Web Forms Control comparison. It is a Win Forms Control to HTML control comparison.
Gary
-
Feb 1st, 2012, 04:25 PM
#7
Re: Curious about multiselect behavior
That sounds right. I'll leave it open, for now, but I suspect that the answer lies in there.
My usual boring signature: Nothing
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|