ASP.NET - how to close WebPage while Required Field Validator in it Enabled.

Asked By Varun Phadke on 19-Jun-12 08:08 AM
dipa ahuja replied to Varun Phadke on 19-Jun-12 08:27 AM
<a href="javascript:window.opener='x';window.close();">Close me</a>
TSN ... replied to Varun Phadke on 19-Jun-12 09:20 AM
if you want to close the web page when the reuired validator is enabled , just disable the required field validator on the UNload event of the body

<body onunload="HandleClose()">

now write a function HandleClose()

function HandleClose()
 // Disable the Required Filed Validator.
ValidatorEnable(document.getElementById('<%=RFValidatorID.ClientID %>'), false);
Jitendra Faye replied to Varun Phadke on 19-Jun-12 09:53 AM
Use different ValidationGroup  for control .

<asp:Button ID="BtnOK" runat="server" Text="ok" ValidationGroup="grp1" OnClick ="BtnOK_Click" />
<asp:Button ID="BtnClose" runat="server" Text="close" ValidationGroup="grp2" OnClientClick ="javascript:window.close();" />

Try this and let me know.
Varun Phadke replied to Jitendra Faye on 20-Jun-12 02:02 AM
THANKS ALL FOR Reply... Worked :)
Varun Phadke replied to TSN ... on 20-Jun-12 02:02 AM
end of post
Varun Phadke replied to dipa ahuja on 20-Jun-12 02:03 AM
end of post
Jitendra Faye replied to Varun Phadke on 20-Jun-12 02:09 AM
you always welcome