我有一个上传表单,我想传递我的信息,如图像和其他一些领域,但我不知道如何上传图像..
这是我的控制器代码:
[HttpPost]
public ActionResult Create(tblPortfolio tblportfolio)
{
if (ModelState.IsValid)
{
db.tblPortfolios.AddObject(tblportfolio);
db.SaveChanges();
return RedirectToAction("Index");
}
return View(tblportfolio);
}
Run Code Online (Sandbox Code Playgroud)
这是我的查看代码:
@model MyApp.Models.tblPortfolio
<h2>Create</h2>
@using (Html.BeginForm(null, null, FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.ValidationSummary(true)
<fieldset>
<legend>tblPortfolio</legend>
<div class="editor-label">
@Html.LabelFor(model => model.Title)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Title)
@Html.ValidationMessageFor(model => model.Title)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.ImageFile)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.ImageFile, new { type = "file" })
@Html.ValidationMessageFor(model => model.ImageFile)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Link)
</div>
<div …Run Code Online (Sandbox Code Playgroud) 可能的重复:
如何选择 SQL 数据库表中的第 n 行?
我有一个表,我想选择“选择 1 条记录”,在其他命令中我想选择第二行,在其他命令中选择第三行……我如何在没有行号的情况下从表顶部选择例如第四条记录。只是我想选择表格顶部的第四行。我怎样才能做到这一点 ?
我开发了一个ASP.NET MVC 3 Web应用程序,它在本地正常工作,但不在服务器上:
Line 18:<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Run Code Online (Sandbox Code Playgroud)
如何修复服务器无法找到此程序集的事实?
我在sql数据库中有一个nvarchar字段..例如我在这个字段中有4000个字符,但我想只选择200个第一个字符并显示在标签中.
我怎样才能做到这一点 ?
我有一个HTML页面,其中包含英语单词和波斯语单词.我想知道如何检测英语单词并改变它们的颜色,并检测波斯语单词并将它们的颜色更改为不同的颜色.
这些词是动态的,可以改变.我想通过jQuery或JavaScript检测它们并更改颜色.
例如,给定此文本:
Hi ???? ?? this ??? text can be ???? ????? ...
Run Code Online (Sandbox Code Playgroud)
我想用红色显示这些单词:
Hi, This, Text, can, be,
Run Code Online (Sandbox Code Playgroud)
这些字是蓝色的:
??, ????, ???, ????, ?????
Run Code Online (Sandbox Code Playgroud) 我想通过雅虎的API获取天气.功能直到html.我alert在功能之前放了html.什么时候它html显示警报给我.但是当它html不起作用之后.它显示html有错误.问题是什么?
<script type="text/javascript">
$(document).ready(function () {
$.simpleWeather({
zipcode: '',
woeid: '@Html.DisplayFor(modelItem => item.zipcode)',
location: '',
unit: 'c',
success: function (weather) {
//html = '<h2>' + weather.city + ', ' + weather.region + '</h2>';
//html += '<img style="float:left;" width="125px" src="' + weather.image + '">';
alert("hi");
html += '<p>' + weather.temp + '° ' + weather.units.temp + '<br /><span>' + weather.currently + '</span></p>';
html += '<a href="' + weather.link + '">View Forecast …Run Code Online (Sandbox Code Playgroud)