List box values on postback
I am using asp.net mvc. I have used two list box in one of my views. I transfer desired items from left-hand-s开发者_开发技巧ide list box to right-side list box. On a button click, i want to get the list box contents from right side list box. I don;t get in form collection. Can anyone please suggest how can I get it?
thanks, kapil
The only values in the list box that are selected will appear in the form collection.
When you transfer to the second list box, I would add a hidden field and add the cvalues into there (with some delimiter between). Upon POST you could split the string value of this hidden value to find contents of right hand list box.
Alternatively, just prior to Submit (intercept with JavaScript), set all values in right hand list box to selected.
精彩评论