Hi,
I have a model class as below:
public class Location
{
public int LocationId {get; set;}
public int LocationName {get; set;}
}
public class Load
{
public string LoadId {get; set;}
public string LoadName {get; set;}
public List<Location> Locations {get; set;}
}
What i'm trying to accomplish is :
1. I need to give an index view, strongly typed by Load class
2. On the client side, Client hits a button, and an $.Ajax() function gets some JSON response from somewhere
3. I need to put this response, as items which go into the model : Model.Locations (which is a list)
What i'm having issues with:
When Jquery gets a reponse, i want to put the response into Model data.
1. This data, put into model (Model.Locations) should be a multiple select list
2. I've tried
@Html.ListBox("Locations",ViewBag.LocationsList as MultiSelectList)
After even trying to send Json Response to server, and trying to put the data into model there.
Anyway, i know the above thing is probably bad idea.
What i need is, I get the JSON response from somewhere, i need to send it to the server, have the server do some work, and then insert into a selectable list.
Can anyone point me in the right direction? would be great help. Thanks.
Again, the only issue here is: putting Jquery (Ajax/JSON) response into model data, where in after populating data, the list is multiselect list, and then the whole form can be submitted for processing.