Ramco Ramco

Ramco Ramco

  • 441
  • 3.4k
  • 506.3k

WebMethod not getting called

Sep 7 2022 3:46 PM

Hi

<script type="text/javascript">
        function BindData(e) {
            var currentRow = $(e).closest("tr");
            var Id = currentRow.find("td:eq(0)").text();

            document.getElementById('txtId').value = Id;
            $.ajax({
                type: "POST",
                url: "DraftedTrainingList.aspx/GetParticipants",
                data: '{id:"' + Id + '"}',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (r) {
                    var ddlParticipant = $("[id*=ddlParticipant]");
                    ddlParticipant.empty().append('<option selected="selected" value="0">Select Participant</option>');
                    $.each(r.d, function () {
                        ddlParticipant.append($("<option></option>").val(this['Value']).html(this['Text']));
                    });
                    $('#modal_form_horizontal').modal("show");
                }
            });
        };
    </script>

 

[WebMethod]
        public static List<ListItem> GetParticipants(Int32 id)
        {
            List<ListItem> orders = new List<ListItem>();

            BALTrainingHeader bALTrainingHeader = new BALTrainingHeader();
            List <TrainingParticipant> Result  = bALTrainingHeader.GetSelectedUsers(id);
            if (Result != null)
            {
                foreach (var colum in Result)
                {
                    //BALAcademy bALAcademy = new BALAcademy();
                    //AcademyMaster objResult = bALAcademy.GetRecordDetails(colum.ParticipantID);
                    //if (objResult != null)
                    //{
                    //    orders.Add(new ListItem
                    //    {
                    //        //Value = Result. .["OrderID"].ToString(),
                    //        //Text = Result.["Freight"].ToString()
                    //    });
                    //}
                }
            }
            return orders;
        }

Thanks


Answers (1)