Καλώς ορίσατε στο dotNETZone.gr - Σύνδεση | Εγγραφή | Βοήθεια

C# and .NET Tips and Tricks

Quests in programming in .NET

Νοέμβριος 2010 - Δημοσιεύσεις

ASP.NET MVC Binding to Lists–Enumerables on POST with JQuery
In this post we see how we can bind to editable IEnumerables-Lists in an ASP.NET MVC view and get the updated values in our HttpPost action. Moreover, we see how we can use JQuery to dynamically add/remove items from the list and have our updates transferred to the HttpPost action. We start by defining a simple class named Client which will be our list element: public class Client { public string FirstName { get ; set ; } public string LastName { get ; set ; } } We implement an Action method that creates a list of Client objects: public ViewResult Simple() { List < Client > Clients = new List < Client >(); Clients.Add( new Client { FirstName = "Giannis" , LastName = "Panagopoulos" }); Clients.Add( new Client { FirstName = "Kostas" , LastName = "Papadopoulos" }); Clients.Add( new Client { FirstName = "Petros" , LastName = "Georgiadis" }); return View(Clients); } The simple view renders the list as follows (with input elements of type text for

Διαβάστε περισσότερα »

Posted: Δευτέρα, 29 Νοεμβρίου 2010 12:15 μμ από iwannis | 0 σχόλια
Δημοσίευση στην κατηγορία:
I am in Teched2010 - Berlin
Another year in Berlin! Another chance to learn great things on Microsoft Technologies.  

Διαβάστε περισσότερα »