$(document).ready(function () { var comapnysearch; $.ajax({ type: "POST", url: 'EmployeeDetails.aspx/comapanynamesearch', contentType: "application/json; charset=utf-8", dataType: "json", async: false, success: function (msg) { companynames = msg.d; } });
[WebMethod(EnableSession = true)] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public static string comapanynamesearch() { try { string strJson = string.Empty; abs_properties_getprofiledetails obp = new abs_properties_getprofiledetails(); abs_sqldb_comapanysearch obl = new abs_sqldb_comapanysearch(); stringjson json = new stringjson(); //stringjson is class file.it convert datatable to string format..// DataTable dt = obl.getEmployeeDetails(obp); if (dt.Rows.Count > 0) { strJson = json.json_string(dt); } return strJson; } catch (Exception ex) { throw (ex); }
public override DataTable comapanynamesearch(abs_properties_getprofiledetails obj) { try { SqlConnection vcon = new SqlConnection(); vcon.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString; SqlCommand vcmd = new SqlCommand(); vcmd.Connection = vcon; vcmd.CommandType = CommandType.StoredProcedure; vcmd.CommandText = "getcomapanynames_sp"; SqlDataAdapter sda = new SqlDataAdapter(); DataTable dt = new DataTable(); sda.Fill(dt); return dt; } catch (Exception ex) { throw (ex); } }
[System.Web.Script.Services.ScriptService]
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)