我有上有3個文本框字段,其中我使用
ASP一個div:使用RequiredFieldValidator和ASP:在更改密碼按鈕CompareValidator股利不會不可見時可見設置爲false按鈕clcik
點擊div變得可見
protected void btnPass_Click(object sender, EventArgs e)
{
chngPwd.Visible = true;
}
並在按鈕上取消可視屬性設置爲false但它不會隱形。
protected void btnCancel_Click(object sender, EventArgs e)
{
chngPwd.Visible = false;
}
ASP代碼如下
<div runat="server" id="chngPwd" visible="false" style="margin-left: 40px">
<div>
<div class="col-md-4"></div>
<div class="col-md-8">
<asp:Label ID="lblOldP" runat="server" Text="Old Password: -"></asp:Label>
<asp:TextBox ID="txtOldP" runat="server" TextMode="Password" Width="149" Height="33px"></asp:TextBox>
</div>
<br />
<br />
</div>
<div>
<div class="col-md-4"></div>
<div class="col-md-8">
<asp:RequiredFieldValidator runat="server" ControlToValidate="txtOldP" CssClass="text-danger" ErrorMessage="The Old Password field is required." />
<br />
</div>
</div>
<br />
<div>
<div class="col-md-4"></div>
<div class="col-md-8">
<asp:Label ID="lblNewP" runat="server" Text="New Password: -"></asp:Label>
<asp:TextBox ID="txtNewP" runat="server" TextMode="Password" Width="149" Height="33px"></asp:TextBox>
</div>
<br />
<br />
</div>
<div>
<div class="col-md-4"></div>
<div class="col-md-8">
<asp:RequiredFieldValidator runat="server" ControlToValidate="txtNewP" CssClass="text-danger" ErrorMessage="The New Password field is required." />
<br />
</div>
</div>
<br />
<div>
<div class="col-md-4"></div>
<div class="col-md-8">
<asp:Label ID="lblRNewP" runat="server" Text="Confirm New Password: -"></asp:Label>
<asp:TextBox ID="txtRNewP" runat="server" TextMode="Password" Width="149" Height="33px"></asp:TextBox>
</div>
<br />
<br />
</div>
<div>
<div class="col-md-4"></div>
<div class="col-md-8">
<asp:RequiredFieldValidator runat="server" ControlToValidate="txtRNewP" CssClass="text-danger" ErrorMessage="The Confirm New Password field is required." />
<br />
<asp:CompareValidator runat="server" ControlToCompare="txtNewP" ControlToValidate="txtRNewP" CssClass="text-danger" ErrorMessage="The Password doesn't match." />
<br />
</div>
</div>
<br />
<div>
<div class="col-md-8"></div>
<div class="col-md-4">
<asp:Button ID="btnSbmt" runat="server" Text="Submit" OnClick="btnChngP_Click" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click" />
</div>
</div>
<br />
<br />
<div>
我們可以看到你使用 – KratosMafia
加在我的問題本身的ASP代碼的ASP。請。 –
以及你的最後一個div應該是/ div – KratosMafia