$("#<%=registrationNumberTextBox.ClientID%>").blur(function() { if ($(this).val().length > 0) { $.ajax({ type: "POST", url: "registration.aspx/GetAmountDue", data: "{'registrationNumber': '" + $(this).val() + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: true, cache: false, success: function(msg) { $("#<%=amountDueLiteral.ClientID%>").val(msg.d); }, error: function(x, e) { alert("The call to the server side failed. " + x.responseText); } }); } else { $("#<%=amountDueLiteral.ClientID%>").html('0.00'); } });
<webmethod()>; _ Public Shared Function GetAmountDue(ByVal registrationNumber As String) As String If registrationNumber.Trim.Length > 0 Then If Student.IsValidRegistration(registrationNumber) Then Dim bi As Student.BasicInformation = Student.GetStudentByRegistrationNumber(registrationNumber) If bi.StudentId <> Nothing Then Dim result As String = String.Format("{0:n2}", bi.StudentAccount.Debit) Return result End If End If End If Return "0.00" End Function
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)