私はasp.net mvcにまったく慣れていません。これは、ユーザーがそのテキストボックスに値を入力したときに、あるビューに1つのテキストボックスを表示する必要がある最初のサンプルプロジェクトです。別のビューのラベルにその値を表示する必要があります。そのために私はこのようにしました..
これは私のコントローラークラスです
public class TextBoxController : Controller
{
//
// GET: /TextBox/
public ActionResult Index()
{
return View();
}
}
これが私のモデルクラスです
namespace MvcTestApplication.Models
{
public class TextboxModel
{
[Required]
[Display(Name= "Textbox1")]
public string EnteredValue { get; set; }
}
}
これが私の見解です
@model MvcTestApplication.Models.TextboxModel
@{
ViewBag.Title = "TextboxView";
}
<h2>TextboxView</h2>
@using (Html.BeginForm())
{
<div>
<fieldset>
<legend>Enter Textbox Value</legend>
<div class ="editor-label">
@Html.LabelFor(m => m.EnteredValue)
</div>
<div class="editor-field">
@Html.TextBoxFor(m=>m.EnteredValue)
</div>
<p>
<input type="submit" value="Submit Value" />
</p>
</fieldset>
</div>
}
ページにテキストボックスとボタンが表示されず、次のようなエラーが発生します
HTTP:404 : リソースが見つかりません
Visual Studio 2012 と mvc4.. を使用しています。
plsはこれについて何かアイデアを提案してくれますか..どうもありがとう..