0
我有一个基本上是三阶段向导的页面。我创建了一个类来保存页面上的所有字段,并隐藏三个DIV中的两个,使它们依次可见。 我使用一个名为“wiz”的变量来跟踪我在哪个阶段。在MVC中构建页面期间丢失隐藏字段3
申请2的3
然而,即使在标签显示来自控制器的正确的值旅行通阶段..
'
' POST: /Apply
<HttpPost()>
Function Apply(ByVal mdl As ApplyViewData, ByVal postbutton As Integer) As ActionResult
..
mdl.wiz = 2
..
Return View(mdl)
End Function
..隐藏字段下方保持不同的价值!我看不到这是什么原因造成的。
<h2>Apply for travel pass stage 2 of 3</h2>
<form action="/Pass/Apply" method="post">
<input id="wiz" name="wiz" type="hidden" value="1" />
<input id="client_address" name="client_address" type="hidden" value="" />
<input id="client_name" name="client_name" type="hidden" value="" />
这看起来没有任何意义。
<h2>Apply for travel pass stage @Model.wiz of 3</h2>
@Code
Html.BeginForm()
End Code
@Html.Hidden("wiz", Model.wiz)
@Html.Hidden("client_address", Model.client_address)
@Html.Hidden("client_name", Model.client_name)
@Html.ValidationSummary()
为什么wiz变量显示为2但隐藏为1?我很难过。
下面是使用的类。
Public Class ApplyViewData
Private m_client_id As Long
Private m_apply_date As Date
Private m_pass_type As Long
Private m_client_search As String
Private m_search_archived As Boolean
Private m_client_name As String
Private m_client_address As String
Private m_proof_of_age As Long
Private m_proof_of_address As Long
Private m_photocard As Long
Private m_ethnicity_id As Long
Private m_new_pass As Boolean
Private m_wiz As Integer
Public Property client_id() As Long
Set(value As Long)
m_client_id = value
End Set
Get
Return m_client_id
End Get
End Property
Public Property apply_date() As Date
Set(value As Date)
m_apply_date = value
End Set
Get
Return m_apply_date
End Get
End Property
Public Property pass_type() As Long
Set(value As Long)
m_pass_type = value
End Set
Get
Return m_pass_type
End Get
End Property
Public Property client_search() As String
Set(value As String)
m_client_search = value
End Set
Get
Return m_client_search
End Get
End Property
Public Property search_archived() As Boolean
Set(value As Boolean)
m_search_archived = value
End Set
Get
Return m_search_archived
End Get
End Property
Public Property client_name() As String
Set(value As String)
m_client_name = value
End Set
Get
Return m_client_name
End Get
End Property
Public Property client_address() As String
Set(value As String)
m_client_address = value
End Set
Get
Return m_client_address
End Get
End Property
Public Property proof_of_age() As Long
Set(value As Long)
m_proof_of_age = value
End Set
Get
Return m_proof_of_age
End Get
End Property
Public Property proof_of_address() As Long
Set(value As Long)
m_proof_of_address = value
End Set
Get
Return m_proof_of_address
End Get
End Property
Public Property photocard() As Long
Set(value As Long)
m_photocard = value
End Set
Get
Return m_photocard
End Get
End Property
Public Property ethnicity_id() As Long
Set(value As Long)
m_ethnicity_id = value
End Set
Get
Return m_ethnicity_id
End Get
End Property
Public Property new_pass() As Boolean
Set(value As Boolean)
m_new_pass = value
End Set
Get
Return m_new_pass
End Get
End Property
Public Property wiz() As Integer
Set(value As Integer)
m_wiz = value
End Set
Get
Return m_wiz
End Get
End Property
End Class