コード例 #1
0
ファイル: Products.aspx.cs プロジェクト: wisepick/gilldstore
 protected void OnPagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
 {
     (Product_ListView.FindControl("DataPager1") as DataPager).SetPageProperties(e.StartRowIndex,
                                                                                 e.MaximumRows,
                                                                                 false);
     (Product_ListView.FindControl("DataPager2") as DataPager).SetPageProperties(e.StartRowIndex,
                                                                                 e.MaximumRows,
                                                                                 false);
     Refresh_Products();
 }
コード例 #2
0
ファイル: Products.aspx.cs プロジェクト: wisepick/gilldstore
        protected void Product_Category_Id_Command(object sender, CommandEventArgs e)
        {
            LinkButton lLinkButton = Product_Category_Repeater.Controls[0].Controls[0].FindControl("Product_Category_Id") as LinkButton;

            if (e.CommandArgument.ToString() == "All")
            {
                lLinkButton.CssClass = "btn-primary";
            }
            else
            {
                lLinkButton.CssClass = "";
            }
            foreach (RepeaterItem lRepeaterItem in  Product_Category_Repeater.Items)
            {
                lLinkButton = lRepeaterItem.FindControl("Product_Category_Id") as LinkButton;
                if (lLinkButton.CommandArgument == e.CommandArgument.ToString())
                {
                    lLinkButton.CssClass = "btn-primary";
                }
                else
                {
                    lLinkButton.CssClass = "";
                }
            }
            if (e.CommandArgument.ToString() == "All")
            {
                Refresh_Products();
            }
            else
            {
                MySqlConnection dbconn = new MySqlConnection(CommonClass.connectionstring);
                dbconn.Open();
                MySqlCommand lMySqlCommand = new MySqlCommand();
                lMySqlCommand.CommandText = "GET_ACIVE_PRODUCTS_BY_CATEGORY";
                lMySqlCommand.CommandType = System.Data.CommandType.StoredProcedure;
                lMySqlCommand.Connection  = dbconn;
                lMySqlCommand.Parameters.AddWithValue("P_PRODUCT_CATEGORY_ID", e.CommandArgument.ToString());
                (Product_ListView.FindControl("DataPager1") as DataPager).SetPageProperties(0,
                                                                                            12,
                                                                                            false);
                (Product_ListView.FindControl("DataPager2") as DataPager).SetPageProperties(0,
                                                                                            12,
                                                                                            false);
                using (MySqlDataAdapter lMySqlDataAdapter = new MySqlDataAdapter(lMySqlCommand))
                {
                    DataTable dt = new DataTable();
                    lMySqlDataAdapter.Fill(dt);
                    Product_ListView.DataSource = dt;
                    Product_ListView.DataBind();
                }
                dbconn.Close();
            }
        }