I want to make a password recovery function where the users needs to enter the mail adress. The mail adress has to be validated by asp.net. I dont want the site to refresh after reseting password. Thats why I disabled autopostback for my button. The problem is that disabling the autopostback also stopped the validation of the input. I dont want to use javascript to validate the input.
So is it possible to disable autopostback but keep the validation behaviour?
Thanks alot!
This is my asp.net code:
<asp:Label>Email: </asp:Label><asp:TextBox id="emailTextbox" TextMode="Email" runat="server" CSSClass="emailTextbox"/>
<asp:Button Text="Anfordern" runat="server" CSSClass="ResetPassword" CausesValidation="True"/>
and this is the called ajax behind the button
function ResetPassword() {
alert($("#<%=emailTextbox.ClientID%>")[0].value);
$.ajax({
type: "POST",
url: "/pages/passwordRecovery.aspx/ResetPassword",
data: '{mail: "' + $("#<%=emailTextbox.ClientID%>")[0].value + '" }',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
//alert(response.d);
}
});
}