Html ASP.NET MVC中未显示文件上载程序?
这是此代码的屏幕截图: 我想上传不同格式的文件。我认为这是由于侧边栏。因为我在新的项目中运行了相同的代码,并且工作得非常好。我想上传不同格式的文件。我认为这是由于侧边栏。因为我在新项目中运行了相同的代码,而且运行得非常好:Html ASP.NET MVC中未显示文件上载程序?,html,css,asp.net-mvc,Html,Css,Asp.net Mvc,这是此代码的屏幕截图: 我想上传不同格式的文件。我认为这是由于侧边栏。因为我在新的项目中运行了相同的代码,并且工作得非常好。我想上传不同格式的文件。我认为这是由于侧边栏。因为我在新项目中运行了相同的代码,而且运行得非常好: @model IEnumerable<ObjFile> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.1
@model IEnumerable<ObjFile>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css" />
<style type="text/css">
/* .btn {
width: 100px;
height: 40px;
background: #00BCD4;
border-style: solid;
border-color: white;
color: white;
}
.gridborder {
border-top: 1px solid #DED8D8;
}*/
</style>
<div>
@using (@Html.BeginForm("Index", "submitFYPReport", FormMethod.Post,
new { enctype = "multipart/form-data" }))
{
if (TempData["Message"] != null)
{
<p style="font-family: Arial; font-size: 16px; font-weight: 200; color: red">@TempData["Message"]</p>
}
<table>
<thead>
<tr>
<td style="width: 50px;">
<b style="color: #FF5722">File:</b>
</td>
</tr>
</thead>
<tbody>
<tr>
<td>
<input type="submit" class="btn btn-danger" name="submit" />
</td>
</tr>
<tr>
<td>
<input type="file" name="files" id="files" multiple="multiple" />
</td>
</tr>
</tbody>
</table>
}
<table class="gridborder row-borderhover order-column dataTable no-footer">
<tr>
<th class="sorting_asc">
@Html.DisplayNameFor(model => model.File)
</th>
<th class="sorting">
@Html.DisplayNameFor(model => model.Size)
</th>
<th class="sorting">
@Html.DisplayNameFor(model => model.Type)
</th>
<th class="sorting"></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td class="sorting_1">
@Html.DisplayFor(modelItem => item.File)
</td>
<td class="sorting_1">
@Html.DisplayFor(modelItem => item.Size)
</td>
<td class="sorting_1">
@Html.DisplayFor(modelItem => item.Type)
</td>
<th class="sorting">
@Html.ActionLink("Download", "Download", new { fileName = item.File })
</th>
</tr>
}
</table>
</div>
@model IEnumerable
/*.btn{
宽度:100px;
高度:40px;
背景:#00BCD4;
边框样式:实心;
边框颜色:白色;
颜色:白色;
}
.网格边界{
边框顶部:1px实心#DED8D8;
}*/
@使用(@Html.BeginForm(“Index”,“submitFYPReport”),FormMethod.Post,
新的{enctype=“multipart/form data”})
{
if(TempData[“Message”]!=null)
{
@TempData[“Message”]
}
文件:
}
@DisplayNameFor(model=>model.File)
@DisplayNameFor(model=>model.Size)
@DisplayNameFor(model=>model.Type)
@foreach(模型中的var项目)
{
@DisplayFor(modeleItem=>item.File)
@DisplayFor(modelItem=>item.Size)
@DisplayFor(modelItem=>item.Type)
@ActionLink(“下载”,“下载”,新的{fileName=item.File})
}
@使用(@Html.BeginForm(“Index”,“submitFYPReport”,FormMethod.Post,new{enctype=“multipart/form data”}))
摆脱第二个@
。所以@使用(Html.BeginForm(…)
。这并没有解决问题。在简单页面上,它运行良好。但侧边栏不起作用。请检查呈现的页面源以确保html存在。浏览器的工具将允许您检查应用的css规则,这可以帮助您确定为什么不显示它。