Hi! I'm developing an asp.net application and need to bind view data to model using jQuery.
I have two UnorderedLists's and using drag&drop between them with jQuery's sortable(), ulSource and ulDestination. In code behind, there are two model class as Destination and Source.
using standart asp.net binding its sth like that:
<asp:BulletedList ID="ulDestination" DataSource="<%# Destination.ActivityList %>" runat="server" />
<asp:BulletedList ID="ulSource" DataSource="<%# Source.ActivityList %>" runat="server" />
If i use server side component asp:BulletList, I can bind model to view but any change I made at client-side with jQuery is lost after PostBack (as expected).
I need a way to update models with new UL items.. I was thinking to make ajax post to a page method like SaveLists(string[] source, string[] destination)..
//psuedo code
[WebMethod]
public void SaveLists(string[] source, string[] destination)
{
Source.ActivityList = source;
Destination.ActivityList = destination;
}
note that I need to make this calls for 5-6 different source-destination pairs.
Do you know any better ways to do that or shall I stick with that .. please comment!
cheers..