我点击按钮显示以下错误"Microsoft JScript运行时错误:对象不支持属性或方法'实时'" 我的查看页面如下:
@model Charis.Models.Products
@{
ViewBag.Title = "Create";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="../../Content/CharisSite.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
@using (Html.BeginForm("Create", "Prod", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.ValidationSummary(true)
<table><tr><td>
<table>
<tr>
<td>
<fieldset>
<legend>Products</legend>
<table>
<tr>
<td>
<div class="editor-label">
@Html.LabelFor(model => model.Productname)
</div>
</td>
<td>
<div class="editor-field">
@Html.EditorFor(model => model.Productname)
@Html.ValidationMessageFor(model => model.Productname)
</div>
</td>
</tr>
<tr>
<td>
<div class="editor-label">
@Html.LabelFor(model => model.ProductPrice)
</div>
</td>
<td>
<div class="editor-field">
@Html.EditorFor(model => model.ProductPrice)
@Html.ValidationMessageFor(model => model.ProductPrice) …Run Code Online (Sandbox Code Playgroud) 我是新手,MVC.我保存了图像和一些数据,但无法显示保存的图像.我想在主页面中显示所有已保存的图像.
模型:从模型中获取数据库列表
public List<Products> GenreList()
{
}
Run Code Online (Sandbox Code Playgroud)
调节器
public ActionResult MYsample()
{
var MyList = storeDB.GenreList();
var a= MyList.Count;
if (a != null)
{
foreach (var li in MyList)
{
return File(li.fileContent, li.mimeType,li.fileName);
}
}
return View(MyList);
}
Run Code Online (Sandbox Code Playgroud)
视图
@foreach (var item in Model)
{
<img src="@Url.Action("MYsample", "HomeController", new { id = item.ProductID })" alt="@item.Productname" />
}
Run Code Online (Sandbox Code Playgroud)