PageMethods.ชื่อMethods(Parameter[], EvertComplete, EvertError);
function EvertComplete(result)
{
}
function EvertError(result)
{
}
CodeBehide
<WebMethod(enableSession:=True)>
Public Shared Function ชื่อMethods(parameter[]) as Typereturn
end Function
ประมาณนี้ ครับ ตัวอย่างมันเป็น VB นะครับ
Date :
2016-02-02 14:29:26
By :
joevoy
No. 3
Guest
Code (JavaScript)
<script type="text/javascript">
var Var = [
<asp:Repeater ID="rptTest" runat="server">
<ItemTemplate>
{
"FirstName": '<%# Eval("FirstName") %>',
"LastName": '<%# Eval("LastName") %>'
}
</ItemTemplate>
<SeparatorTemplate>
,
</SeparatorTemplate>
</asp:Repeater>
];
for (var i = 0; i < Var.length; i++) {
//TODO;
}
</script>
Code (VB.NET)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'If Not IsPostBack Then
rptTest.DataSource = MakeData()
rptTest.DataBind()
'End If
End Sub
Protected Function MakeData() As DataTable
Dim dt As New DataTable()
dt.Columns.Add("FirstName", GetType(String))
dt.Columns.Add("LastName", GetType(String))
'Fill Data...
Return dt
End Function