Ejemplo n.º 1
0
        private void MakeSearch()
        {
            I_EshopserviceClient client = new I_EshopserviceClient();

            try
            {
                ResultTable = client.GetProductsBySearch(_QueryString);

                Repeater_SearchResult.DataSource = ResultTable;
                Repeater_SearchResult.DataBind();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Unable to send Querystring: " + _QueryString + "\nMessage: " + ex.Message);
            }

            int resultnr = 1;

            foreach (RepeaterItem item in Repeater_SearchResult.Items)
            {
                Label lbl_resultnr = (Label)item.FindControl("lbl_ResultNumber");
                lbl_resultnr.Text = "Nr: " + resultnr;

                resultnr++; //+1 foreach item
            }
        }
Ejemplo n.º 2
0
        public string[] CompleteText(string prefixText, int count)
        {
            I_EshopserviceClient client = new I_EshopserviceClient();
            DataTable            result = new DataTable();

            try
            {
                result = client.GetProductsBySearch(prefixText);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Something went wrong with autocomplete: " + ex.Message);
            }

            var rowColl = result.AsEnumerable();    //Makes it possible to use linq on datatable

            //Selects only all results under the column PTitle to a string array
            string[] products = (from r in rowColl select r.Field <string>("PTitle")).ToArray();

            return(products);
        }