Q&A
以下の通り、
ビュー、モデル、コントローラーを使用しています。
ビュー側でテキストボックス(TextBoxFor)を使用したいのですが、
「m.」の後、モデルのTargetを呼び出すことができません。
どういった記述が足りないのでしょうか。
ご教授いただければ幸いです。
よろしくお願いいたします。
■環境
・Windows10
・VS Community 2017
・MVC
▼Home.vbhtml
@Code ViewBag.Title = "Fortune" End Code <h2>@ViewBag.Title</h2> @using (html.BeginForm("Home", "HomeController")) @<text> @Html.TextBoxFor(Function(m) m.) </text> End Using
▼HomeViewModel.vb
Imports System.Web.Mvc Public Class HomeViewModel Public Property Target As HomeModel Public Sub New() Target = New HomeModel() End Sub End Class Public Class HomeModel Public Property 名前 As String End Class
▼HomeController.vb
Imports System.Web.Mvc Public Class HomeController Inherits System.Web.Mvc.Controller 'GET: Home <HttpGet> Function Home() As ActionResult Return View() End Function 'POST <HttpPost> Function Home(model As HomeViewModel) As ActionResult Return View(model) End Function End Class
回答1件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。