-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGetStudentByID_WebForm.aspx
More file actions
72 lines (66 loc) · 2.59 KB
/
GetStudentByID_WebForm.aspx
File metadata and controls
72 lines (66 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GetStudentByID_WebForm.aspx.cs" Inherits="GetStudentByID_WebForm" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Get Student By ID Using Service,ADO and AJAX</title>
<script type="text/javascript">
function GetStudentById() {
let id = document.getElementById("txtStudentID").value;
// alert('Id is ' + id);
//call the WebMethod use namespace.class.method
// GetStudentById(id, SuccessCallBack(), ErrorCallBack());
StudentListWebService.GetStudentById(id, SuccessCallBack, ErrorCallBack);
}
function SuccessCallBack(results) {
let name = results["StudentName"];
alert("name = " + name);
document.getElementById("txtStudentName").value = results["StudentName"];
document.getElementById("txtYear").value = results["StudentYear"];
document.getElementById("txtMarks").value = results["StudentTotalMarks"];
}
function ErrorCallBack(error) {
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/StudentListWebService.asmx" />
</Services>
</asp:ScriptManager>
<div>
<table>
<tr>
<td>Student ID</td>
<td>
<asp:TextBox ID="txtStudentID" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Student Name</td>
<td>
<asp:TextBox ID="txtStudentName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Student Year</td>
<td>
<asp:TextBox ID="txtYear" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>Student Total Marks</td>
<td>
<asp:TextBox ID="txtMarks" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<input id="btnGetData" type="button" value="Get Student Record" onclick="GetStudentById()" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>