我有一个简单的模态如下,
public class Student{
public string Name;
public HttpPostedFileBase file;
// and some other properties of student
}
如下所示的必要药水,
@model Student
@using (Html.BeginForm("Index", "Student", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" name="file" />
<input type="submit" name="Submit" id="Submit" value="Upload" />
/*complex javascript based user selection would not erase when user click on submit button*/
}
我的帖子方法如下,
[HttpPost]
public ActionResult Index(Student student){
//post data to the server and need got the feed back of save status success or fails. Based on that, some potuon of Ui need to change.
return View(student);
//ooh my complex ui erased.
}
当我在代码中描述问题时,我该如何克服这种情况。
你可能会建议你可以在这里使用ajax动作方法。但女巫无法使用,因为我需要将帖子文件发送到行动。
我认为这是不可能实现的,但这是常见的问题。
赞美你的建议使这项工作。(我不能在这里使用iframe)