Esempio 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
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string searchCatalogue = Request.QueryString["catelog"];
            string searchContent   = Request.QueryString["content"];

            //string searchCatalogue = DropDownList_SearchCatalogue.Text;
            //string searchContent = TextBox_Search.Text;
            //TextBox_Search.Text = searchContent;

            if (!IsPostBack)
            {
                Repeater_SearchResult.DataSource = BusinessLogic.ShowBySearch(searchCatalogue, searchContent);
                Repeater_SearchResult.DataBind();

                foreach (RepeaterItem q in Repeater_SearchResult.Items)
                {
                    string isbn = (q.FindControl("Label4") as Label).Text.ToString();
                    if ((new BusinessLogic()).ShowOriginalPrice(isbn))
                    {
                        (q.FindControl("Label6") as Label).Visible = true;
                    }
                    else
                    {
                        (q.FindControl("Label6") as Label).Visible = false;
                    }
                }
            }
        }
        protected void Button_Search_Click(object sender, EventArgs e)
        {
            string searchCatalogue = DropDownList_SearchCatalogue.Text;
            string searchContent   = TextBox_Search.Text;

            Response.Redirect("~/SearchResult.aspx?catelog=" + searchCatalogue + "&" + "content=" + searchContent);

            Repeater_SearchResult.DataSource = BusinessLogic.ShowBySearch(searchCatalogue, searchContent);
            Repeater_SearchResult.DataBind();

            foreach (RepeaterItem q in Repeater_SearchResult.Items)
            {
                string isbn = (q.FindControl("Label4") as Label).Text.ToString();
                if ((new BusinessLogic()).ShowOriginalPrice(isbn))
                {
                    (q.FindControl("Label6") as Label).Visible = true;
                }
                else
                {
                    (q.FindControl("Label6") as Label).Visible = false;
                }
            }
        }