TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
william
NA
8
3.7k
Posting listboxdetails back to ActionResult via @Html.ActionLink
Dec 7 2011 4:27 AM
Hi All,
On an MVC3 project I have a form with the classic 2 listbox setup and Moving items between them.
I had all this working fine on a submit button and a bit of JQuery picking up the values before posting them via an Ajax/Json call to the server. I have now been told that I am not allowed to do it this way and instead I have to use an @Html.ActionLink with a post to an ActionResult. Does anybody have a good example of how to get this working. I've looked and tried loads of things, but I just cannot get the items in the listboxes to post back.
Here is 1 of the listboxes (the other is basically the same).
@Html.ListBox("Available", new MultiSelectList(Model.AvailableFloatingZones, "PolicyID", "FullAddress", new { style = "width:100%" })
My Controller Method signature:
public ActionResult Link(int policyZoneID, string[] available).... I have also tried List<string> available
My button:
@Html.ActionLink("Link/Unlink", "Link", "PolicyZone", new { policyZoneID = Model.PolicyZoneID, available = }, new { @class = "btnProcess" })
how do I capture the listbox contents to pass in the above statement. Also as an aside, I notice that there is also an @ajax.ActionLink can anybody tell me the difference between the 2.
Reply
Answers (
0
)
Display in gridview two tables columns
I had dynamically creating the drop down list and placed in the tablecell and based on the button click ?