Example #1
0
        //this method is to get data to implement search by name
        public static List <productdetails> getdetailsbyname(string spname, SqlParameter q)
        {
            List <productdetails> L = new List <productdetails>();

            try
            {
                con.Open();
                cmd             = new SqlCommand(spname, con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(q);
                SqlDataReader  sdr = cmd.ExecuteReader();
                productdetails p   = null;
                while (sdr.Read())
                {
                    p                  = new productdetails();
                    p.Srno             = int.Parse(sdr[0].ToString());
                    p.Productname      = sdr[1].ToString();
                    p.Ramsize          = sdr[2].ToString();
                    p.Amount           = int.Parse(sdr[3].ToString());
                    p.Flipkart_assured = sdr[4].ToString();
                    p.Colour           = sdr[5].ToString();
                    p.Sim_type         = sdr[6].ToString();
                    L.Add(p);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                con.Close();
            }
            return(L);
        }
Example #2
0
        //displaying data in grid of user search operation based on name
        protected void Button1_Click(object sender, EventArgs e)
        {
            productdetails pd = new productdetails();

            pd.Productname = TextBox1.Text;

            Userbl ub = new Userbl();

            GridView1.DataSource = ub.getdetailsbyname(pd.Productname);
            GridView1.DataBind();
        }
Example #3
0
        protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
        {
            Userbl         ub = new Userbl();
            productdetails p  = new productdetails();

            p.Productname = DropDownList2.SelectedValue;
            if (DropDownList2.SelectedValue == "NULL")
            {
                p.Productname = null;
            }
            Session["productname"] = p.Productname;
            p.Colour             = (string)Session["colour"];
            p.Ramsize            = (string)Session["ramsize"];
            GridView1.DataSource = ub.getfilters(p.Productname, p.Ramsize, p.Colour);
            GridView1.DataBind();
        }