url-action

Why is my AJAXoned Action's return not being seen as successful by the caller?

喜夏-厌秋 提交于 2019-12-12 05:59:51
问题 In my ASP.NET MVC app, I've got this AJAX call in my View's script section: $(".ckbx").change(function () { . . . $.ajax({ type: 'GET', url: '@Url.Action("GetUnitReportPairVals", "Home")', data: { unit: unitval, report: rptval }, cache: false, success: function (result) { alert(result); } }); }); Stepping through the Controller action being called: public ActionResult GetUnitReportPairVals(string unit, string report) { HomeModel model = new HomeModel(); int rptId = GetReportIDForName(report);

Display byte[] array image from database in Details page template using ASP.NET MVC

旧城冷巷雨未停 提交于 2019-12-06 08:06:00
问题 When I try to display a byte[] array image inside a Details page template using: public FileContentResult RenderPhoto(byte[] photo) { // var array = (byte[])Session["photo"]; // return File(array, "image/jpeg"); return File(photo, "image/jpeg"); } <img src="@Url.Action("RenderPhoto", Model.Photo)"/> photo is null. If I store student.Photo in Session: // // GET: /Student/Details/5 public ViewResult Details(int id) { Student student = db.Students.Find(id); Session["photo"] = student.Photo;

Display byte[] array image from database in Details page template using ASP.NET MVC

落花浮王杯 提交于 2019-12-04 14:56:21
When I try to display a byte[] array image inside a Details page template using: public FileContentResult RenderPhoto(byte[] photo) { // var array = (byte[])Session["photo"]; // return File(array, "image/jpeg"); return File(photo, "image/jpeg"); } <img src="@Url.Action("RenderPhoto", Model.Photo)"/> photo is null. If I store student.Photo in Session: // // GET: /Student/Details/5 public ViewResult Details(int id) { Student student = db.Students.Find(id); Session["photo"] = student.Photo; return View(student); } and try to display the image retrieving the value from Session (commented lines