I'm new to MVC and would like a little high level guidance.
I have the following classes, a Document which has a list of questions. Question has an order property to arrange the order of the questions for each document.
public class Question
{
public int QuestionId {get; set;}
public string Text {get; set;}
public int Order {get; set;}
}
public class Document
{
public int DocumentId {get; set;}
public string DocumentName {get; set;}
public List<Question> Questions {get; set;}
}
I want to show a document with its list of questions and allow the user to click a control next to the question which moves it up or down in the list.
What components should I use to update the Order property and reflect it on screen as the changes are made? I'm guessing I don't need to post until the user has made all the changes but what's the best way to update the view immediately?
POST, you just call the.serialise()method of thesortableelement, this will give you aJSONstructure of the new order of the elements, all ready to send usingjQuery.ajax(). You should be able to find a number of examples by just googling "jQuery mvc sortable ajax" - e.g. stackoverflow.com/questions/3311938/…