public class Employee { public string Subject { get; set; } public string SrvcRef { get; set; } } [WebMethod] public static List<employee> GetEmployee(string ID) { SqlCommand cmd = new SqlCommand("...."); GetData.con.Open(); List<employee> employees = new List<employee>(); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { var employee = new Employee { Subject = dr["Subject"].ToString(), SrvcRef = dr["SrvcRef"].ToString() }; employees.Add(employee); } //Close Connection dr.Close(); GetData.con.Close(); return employees; }
$(document).on("click", "#LoadLocalDialog1", function () { var ID = $("#<%=grdExiRequest.ClientID %> tr").find("td:eq(0)").html(); PageMethods.GetEmployee(ID, onSucess); function onSucess(result) { var speed = $(result).data("Subject"); } $("#LocalDialogModal").dialog("open"); });
public JsonResult GetEmployee(string ID) { // retrieve your list here return Json(list, JsonRequestBehavior.AllowGet); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)