I have a Asp.net MVC web application, containing mostly text. I want to put a feature into it so that admin can easily edit text/html using the web. May be some double clicking on a page and converting it into editable and save able. How can i do it? any sample code?
I need this to be done for Asp.net MVC.
Use a jQuery Edit in Place plugin.
<p>has a class ‘editable’When the user requesting the page is an admin, do a
$(document).ready(function() {
$(‘p.editable’).editable(…);
});
When the admin edits text, submit it to an action like this:
public JSONResult Edit(int id, string content){
/* Update content /
/ Return new text from database (in case something went wrong, the data won’t have changed – you could return a JSON datastructure signaling an error */
return Json(newcontent);
}
Insert the new content in the paragraph.