protected void Button1_Click(object sender, EventArgs e)
    {
        val = TextBoxSearch.Text;

        string CS = ConfigurationManager.ConnectionStrings["CustomerInfoConnectionString"].ConnectionString;

        string s = "";

        s += "'";
        s += val;
        s += "%";
        s += "'";
        using (SqlConnection con = new SqlConnection(CS))
        {
            using (SqlCommand cmd = new SqlCommand("select * from ProductDetails where CarName like " + s, con))
            {
                using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
                {
                    DataTable dtBrands = new DataTable();
                    sda.Fill(dtBrands);
                    RepeaterProduct.DataSource = dtBrands;
                    RepeaterProduct.DataBind();
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((string)(Session["key"]) != null)
        {
            val = (string)(Session["key"]);

            string CS = ConfigurationManager.ConnectionStrings["CustomerInfoConnectionString"].ConnectionString;

            string s = "";
            s += "'";
            s += val;
            s += "%";
            s += "'";
            using (SqlConnection con = new SqlConnection(CS))
            {
                using (SqlCommand cmd = new SqlCommand("select * from ProductDetails where CarName like " + s, con))
                {
                    using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
                    {
                        DataTable dtBrands = new DataTable();
                        sda.Fill(dtBrands);
                        RepeaterProduct.DataSource = dtBrands;
                        RepeaterProduct.DataBind();
                    }
                }
            }
        }


        Session["key"] = null;
    }
Example #3
0
        private void LoadProductByID()
        {
            String product_id = Request.QueryString["id"].ToString();
            int    converId   = Int16.Parse(product_id);

            if (DB.getProductByID(converId).Rows.Count > 0)
            {
                RepeaterProduct.DataSource = DB.getDetailProductByID(converId);
                RepeaterProduct.DataBind();
            }
        }
Example #4
0
    private void BindProductRepeater()
    {
        string CS = ConfigurationManager.ConnectionStrings["CustomerInfoConnectionString"].ConnectionString;

        using (SqlConnection con = new SqlConnection(CS))
        {
            using (SqlCommand cmd = new SqlCommand("select * from ProductDetails", con))
            {
                using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
                {
                    DataTable dtBrands = new DataTable();
                    sda.Fill(dtBrands);
                    RepeaterProduct.DataSource = dtBrands;
                    RepeaterProduct.DataBind();
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string myid = Request.QueryString["id"];

        string CS = ConfigurationManager.ConnectionStrings["CustomerInfoConnectionString"].ConnectionString;

        using (SqlConnection con = new SqlConnection(CS))
        {
            using (SqlCommand cmd = new SqlCommand("select * from ProductDetails where id='" + myid + "'", con))
            {
                using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
                {
                    DataTable dtBrands = new DataTable();
                    sda.Fill(dtBrands);
                    RepeaterProduct.DataSource = dtBrands;
                    RepeaterProduct.DataBind();
                }
            }
        }
    }