예제 #1
0
파일: Common.cs 프로젝트: manishc2c/TTSH4-3
    public static void FillComboNew(this System.Web.UI.WebControls.DropDownList ddl, DropDownName dname, string Condition = "")
    {
        //TTSHWCFServiceClient cl = new TTSHWCFServiceClient();
        //try
        //{

        //    List<TTSHWCFReference.clsDropDown> ddllist = cl.GetDropDownData(dname, Condition, "", "", "", "").ToList();
        //    ddl.DataSource = ddllist;
        //    ddl.DataTextField = "DisplayField";
        //    ddl.DataValueField = "ValueField";
        //    ddl.DataBind();
        //    ddl.Items.Insert(0, new ListItem("--Select--", "-1"));
        //}
        //catch
        //{ }
    }
예제 #2
0
파일: Common.cs 프로젝트: manishc2c/TTSH4-3
 public static void FillCombo(this System.Web.UI.WebControls.DropDownList ddl, DropDownName dname, string Condition = "")
 {
     try
     {
         List <clsDropDown>   ddllist = new List <clsDropDown>();
         System.Net.WebClient client  = new System.Net.WebClient();
         client.Headers.Add("content-type", "application/json");//set your header here, you can add multiple headers
         string arr = client.DownloadString(string.Format("{0}api/DropDownData/{1}?&param1={2}", HttpContext.Current.Session["WebApiUrl"].ToString(), dname.ToString(), Condition));
         JavaScriptSerializer serializer = new JavaScriptSerializer();
         ddllist            = serializer.Deserialize <List <clsDropDown> >(arr);
         ddl.DataSource     = ddllist;
         ddl.DataTextField  = "DisplayField";
         ddl.DataValueField = "ValueField";
         ddl.DataBind();
         ddl.Items.Insert(0, new ListItem("--Select--", System.Convert.ToString(0)));
     }
     catch (Exception ex)
     { }
 }
예제 #3
0
파일: Common.cs 프로젝트: manishc2c/TTSH4-3
    public static void FillCheckList(this System.Web.UI.WebControls.CheckBoxList chkboxlst, DropDownName dname, string condition = "", string condition1 = "")
    {
        //TTSHWCFServiceClient cl = new TTSHWCFServiceClient();
        //try
        //{

        //    List<TTSHWCFReference.clsDropDown> ddllist = cl.GetDropDownData(dname, condition, condition1, "", "", "").ToList();
        //    chkboxlst.DataSource = ddllist;
        //    chkboxlst.DataTextField = "DisplayField";
        //    chkboxlst.DataValueField = "ValueField";
        //    chkboxlst.DataBind();
        //}
        //catch
        //{ }
    }
예제 #4
0
 public static void FillCombo(this System.Web.UI.WebControls.DropDownList ddl, DropDownName dname, string Condition = "")
 {
     try
     {
         List <clsDropDown> ddllist = new List <clsDropDown>();
         using (var client = new HttpClient())
         {
             //client.BaseAddress = new Uri(ConfigurationManager.AppSettings["WebApiUrl"].ToString());
             client.BaseAddress = new Uri(System.Web.HttpContext.Current.Session["WebApiUrl"].ToString());
             client.DefaultRequestHeaders.Accept.Clear();
             client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
             HttpResponseMessage response = client.GetAsync(string.Format("api/DropDownData/{0}?&param1={1}", dname.ToString(), Condition)).Result;
             //response.Content.ReadAsStringAsync().Result
             if (response.IsSuccessStatusCode && !string.IsNullOrEmpty(response.Content.ReadAsStringAsync().Result))
             {
                 System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                 ddllist = serializer.Deserialize <List <clsDropDown> >(response.Content.ReadAsStringAsync().Result);
             }
         }
         ddl.DataSource     = ddllist;
         ddl.DataTextField  = "DisplayField";
         ddl.DataValueField = "ValueField";
         ddl.DataBind();
         ddl.Items.Insert(0, new ListItem("--Select--", System.Convert.ToString(0)));
     }
     catch (Exception ex)
     { }
 }