Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to implement a listbox with " Add / Remove" buttons using asp.net mvc and jquery
    primarykey
    data
    text
    <p>Currently i have the following partial view which list all the available users and a "Add User to Class" link beside each user to register a user in a class:-</p> <pre><code>@model IEnumerable&lt;Elearning.Models.User&gt; &lt;tr&gt; &lt;th&gt; Student ID &lt;/th&gt; &lt;/tr&gt; @foreach (var item in Model) { &lt;tr &gt; &lt;td&gt; @Html.DisplayFor(modelItem =&gt; item.UserID) &lt;/td&gt; &lt;td id = "userclass"&gt; @Ajax.ActionLink("Add User to Class", "Register", "User", new { id = item.UserID, classid = ViewBag.id }, new AjaxOptions { InsertionMode = InsertionMode.InsertAfter, HttpMethod = "POST", UpdateTargetId = "incrementadd" }) &lt;/td&gt; &lt;/tr&gt; } </code></pre> <p>The action method which will be called when clicking on the "Add User to Class" link is:-</p> <pre><code>[AcceptVerbs(HttpVerbs.Post)] public PartialViewResult Register(string id, int classid) { try { //Update code here User user = r.FindUser(id); Users_Classes uc = new Users_Classes(); uc.AddedDate = DateTime.Now; uc.ClassID = classid; user.Users_Classes.Add(uc); r.Save(); ViewBag.classid = classid; return PartialView("_usersearch2", uc); } } </code></pre> <p>The above code is working fine , but i find it not easy to add each user by clicking on the link. So i am trying to add a listbox with a add/remove buttons to register and unregister user based on user selection, but i can not figure out how i can modify my code to implement the listbox with "Add/Remove" button using Jquery to make my system more user friendly. can anyone refer me to helping materials or sample code which can help me in my development? Best Regards</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload