Click here to Skip to main content
15,885,988 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to call webmethod from aspx.vb page in vb.net (i am unable to webmethod from codebehind )
JavaScript
$(document).ready(function () {
    $('table').delegate('td.EditRow','click',function () {
        var $row = this;
        var userid = $row.id;
        $('#hdnUserId').val(userid);
        $.ajax({
            type: "POST",
            url: "User_Create_Update.aspx/FillUserDetails",
            data: "{'userid': " + userid + "}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",          
            success: function (msg) {
                if (msg.d != '') {
                    $('#txtUserCode').val(msg.d.USRM_USER_CD);
                    $('#txtUserName').val(msg.d.USRM_USER_NAME);
                }
            }
        });
        $('#divPopUp').lightbox_me({
            lightboxSpeed: 500,
            centered: true,
            closeClick: true,
            closeEsc: true
        })
    });
});

VB
<System.Web.Services.WebMethod()> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _
Public Shared Function FillUserDetails(ByVal userid As String) As DataTable
    Dim dt As DataTable = clsUSRM.GetAllById(userid)
    If dt.Rows.Count > 0 Then
        clsUSRM.USRM_USER_CD = userid
        clsUSRM.USRM_USER_NAME = dt.Rows(1).ToString()

    End If
    Return dt
End Function
Posted
Updated 31-Jan-13 4:09am
v2
Comments
ZurdoDev 31-Jan-13 11:42am    
This is a repost. Did you ever add <system.web.script.services.scriptservice> to the class?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900