我有一个页面,它基本上是一个三阶段向导。我创建了一个类来保存页面上的所有字段并隐藏三个 DIV 中的两个,使它们依次可见。我使用一个名为“wiz”的变量来跟踪我所处的阶段。
申请旅行通行证第 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="" />
查看 View 源代码是没有意义的。
<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