I have a div with 3 text box fields on it where i am using
asp:RequiredFieldValidator and asp:CompareValidator
on change password button click the div getting visible
protected void btnPass_Click(object sender, EventArgs e)
{
chngPwd.Visible = true;
}
and on the button cancel visible property set to false but its not going invisible.
protected void btnCancel_Click(object sender, EventArgs e)
{
chngPwd.Visible = false;
}
ASP code is as follows
<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>