I have one textbox (Mandatory using RequiredFieldValidator) and one submit button. I have applied an loading gif using the following code on button's OnClientClick
.
<asp:Image ID="ImgAjaxloaderClarification" ImageUrl="/images/ajaxloadernew.gif"
AlternateText="Loading Image" runat="server"/>
<asp:ImageButton ID="btnRequestClarification" runat="server"
ImageUrl="/images/btn_RequestFutureClarif.png" ValidationGroup="VGFillHours"
OnClientClick="return showContent();"
OnClick="btnRequestClarification_Click" />
Following is the javascript function to show the loader gif. (Initially the gif set as display:'none')
<script type="text/javascript" language="javascript">
function showContent()
{
if (document.getElementById("<%=RequiredFieldValidator1.ClientID %>").getAttribute("IsValid"))
{
document.getElementById("<%=ImgAjaxloaderClarification.ClientID %>").style.display = "block";
return true;
}
return false;
}
</script>
The issue is RequiredFieldValidator was working fine before calling the OnClientClick function. But it has suddenly stoped working. Allthough the gif is shown but the RequiredFieldValidator is not working.
Any help.