its my aspx code
<body>
<script src="js/jquery-1[1][1].8.0.js" type="text/javascript"></script>
<form id="form1" runat="server">
<script type="text/javascript" language="javascript">
function add() {
try {
alert("aaa");
var classname = 0;
var no = 0;
classname = $("#txt1").val();
no = $("#txt2").val();
}
catch (e) {
alert(e);
}
}
function Clear() {
try {
$("#txt1").val("");
$("#txt2").val("");
} catch (e) {
alert(e);
}
}
function save() {
var a = $("#txt1").val();
var b = $("#txt2").val();
$.ajax({ type: "POST",
async: false,
url: "WebService1.asmx/add",
data: "{a:'" + a + "',b:'" + b + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
Clear();
}
});
}
</script>
<div style="background-color: #669999">
<h2> JQUERY TEST WORK</h2>
<table>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="className"></asp:Label>
<asp:TextBox ID="txt1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="NO"></asp:Label>
<asp:TextBox ID="txt2" runat="server"></asp:TextBox>
</td>
</tr>
</table>
<asp:Button ID="Button1" runat="server" Text="Save" OnClientClick="save();return false;"/>
<asp:Button ID="Button2" runat="server" Text="Clear" OnClientClick ="Clear();return false;" />
<asp:MultiView ID="MultiView1" runat="server">
<asp:View ID="View1" runat="server">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="classId" HeaderText="classId" />
<asp:BoundField DataField="className" HeaderText="className" />
<asp:BoundField DataField="noOfSeats" HeaderText="noOfSeats" />
<asp:CommandField HeaderText="SELECT" ShowSelectButton="True" />
<asp:CommandField HeaderText="DELETE" ShowDeleteButton="True" />
</Columns>
</asp:GridView>
</asp:View>
</asp:MultiView>
</div>
</form>
</body>
</html>
its my asmx code
[WebMethod]
public void add(string a,decimal b )
{
Classinfo infoclass = new Classinfo();
ClassSp spclass = new ClassSp();
infoclass.className = a;
infoclass.noOfSeats = b;
spclass.classAdd(infoclass);
}
i want to fill my grid at the time of save
what is the jquery to fil my grid