Validate page correctly
Validate page correctly
I have a few textboxes gathering info all with validation controls in an asp net page.
When the page is fully valid i would like the user to download a file and show a panel box and hide the original. To do this i have
<script>
$(function () {
$('#<%=pnlDone.ClientID%>').hide();
$('#<%=pnlOne.ClientID%>').show();
if (Page_IsValid(""))
$('#<%=Button1.ClientID%>').click(function () {
setTimeout(function () {
$('#<%=pnlDone.ClientID%>').show();
$('#<%=pnlOne.ClientID%>').hide();
}, 1000);
});
});
</script>
This worked well but the problem im now getting is the download file (in codebehind using a Response object) doesnt kick in since adding the above Jquery.
Taking the
if (Page_IsValid(""))
Out, resolves it but the (syntax to me looks correct, considering im not 100% fluent with Jquery) problem i then have is when the button is clicked it displays the pnlDone when the page isnt valid (i.e. textboxes are still to be filled).
How could i change this so if the page is valid then the download shows including the correct panel (remember removing the Page_Isvalid has the page working exactly the way i want)?