I have a blog editing page in which you can save your changes or upload an image (several posts in one form). When you upload an image, an image link is added to the TinyMCE content area.
The fields for the form are in the viewusercontrol (together with the created page). Both the viewpage and usercontrol inherit from BlogPost, so the model is passed directly using<% Html.RenderPartial("Fields", Model); %>
So, here is a strange thing; in my controller, when I add a link to an image in a text box, nothing happens with the text box in the view
On my browse page, I have a label for Model.Title, and inside usercontrol I have a text box for editing Model.Title.
If I update the label in the controller - model.Title = "New Title"- the updated model data changes for the label on the browse page, but not in the text field in usercontrol.
My controller is as follows:
public ViewResult Edit(int id, BlogPost model, string submit)
{
if (ModelState.IsValid)
{
switch (submit)
{
case "Upload":
var files = UploadFiles(Request.Files);
model.Content += files[0].Link;
model.Title = "Test";
return View(model);
default:
repository.Update(model);
break;
}
}
return View(model);
}
Any ideas on what causes this and how to fix it? Thank.
source
share