private void GetCategories()
 {
     ShoppingCart k = new ShoppingCart();
     DataTable dt = k.GetCategories();
     if (dt.Rows.Count > 0)
     {
         gvAvailableCategories.DataSource = dt;
         gvAvailableCategories.DataBind();
     }
 }
 private void GetCategories()
 {
     ShoppingCart k = new ShoppingCart();
     DataTable dt = k.GetCategories();
     if (dt.Rows.Count > 0)
     {
         ddlCategory.DataValueField = "CategoryID";
         ddlCategory.DataTextField = "CategoryName";
         ddlCategory.DataSource = dt;
         ddlCategory.DataBind();
     }
 }
        protected void gvAvailableProducts_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            DataRowView drv = e.Row.DataItem as DataRowView;
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if ((e.Row.RowState & DataControlRowState.Edit) > 0)
                {
                    ContentPlaceHolder cpl = Page.Master.FindControl("ContentPlaceHolder1") as ContentPlaceHolder;
                    ScriptManager scriptmanager1 = Page.Master.FindControl("ScriptManager1") as ScriptManager;
                    scriptmanager1.RegisterPostBackControl(cpl);

                    ShoppingCart k = new ShoppingCart();
                    DropDownList dp = (DropDownList)e.Row.FindControl("DropDownList1");
                    DataTable dt = k.GetCategories();
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        ListItem lt = new ListItem();
                        lt.Value = dt.Rows[i][0].ToString();
                        lt.Text = dt.Rows[i][1].ToString();
                        dp.Items.Add(lt);
                    }
                }
            }
        }
Exemple #4
0
 private void GetCategory()
 {
     ShoppingCart k = new ShoppingCart();
     dlCategories.DataSource = null;
     dlCategories.DataSource = k.GetCategories();
     dlCategories.DataBind();
 }