Exemplo n.º 1
0
    private void BindDatalist(int currentpage)
    {
        pds.AllowPaging      = true;
        pds.PageSize         = 8;
        pds.CurrentPageIndex = currentpage;

        if (Session["ShopId"] != null)
        {
            BuyerDSTableAdapters.View_Phone_ShopTableAdapter HotPhoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
            DataTable HotPhoneDT = HotPhoneDA.GetHotByShopId(long.Parse(Session["ShopId"].ToString()));
            if (HotPhoneDT.Rows.Count != 0)
            {
                lblShopName.Text     = HotPhoneDT.Rows[0][22].ToString();
                imgShopLogo.ImageUrl = HotPhoneDT.Rows[0][29].ToString();
                for (int i = 0; i < HotPhoneDT.Rows.Count; i++)
                {
                    switch (i)
                    {
                    case 0:
                    {
                        img1.ImageUrl             = HotPhoneDT.Rows[i][16].ToString();
                        lbtnName1.Text            = HotPhoneDT.Rows[i][1].ToString();
                        lbtnName1.CommandArgument = HotPhoneDT.Rows[i][0].ToString();
                        break;
                    }

                    case 1:
                    {
                        img2.ImageUrl             = HotPhoneDT.Rows[i][16].ToString();
                        lbtnName2.Text            = HotPhoneDT.Rows[i][1].ToString();
                        lbtnName2.CommandArgument = HotPhoneDT.Rows[i][0].ToString();
                        break;
                    }

                    case 2:
                    {
                        img3.ImageUrl             = HotPhoneDT.Rows[i][16].ToString();
                        lbtnName3.Text            = HotPhoneDT.Rows[i][1].ToString();
                        lbtnName3.CommandArgument = HotPhoneDT.Rows[i][0].ToString();
                        break;
                    }
                    }
                }
            }
            BuyerDSTableAdapters.View_Phone_ShopTableAdapter AllPhoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
            DataTable AllPhoneDT = AllPhoneDA.GetDataByShopId(long.Parse(Session["ShopId"].ToString()));
            if (AllPhoneDT.Rows.Count != 0)
            {
                pds.DataSource     = AllPhoneDT.DefaultView;
                dlPhone.DataSource = pds;
                dlPhone.DataBind();
            }
        }
    }
Exemplo n.º 2
0
    protected void dlShop_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Footer)
        {
            Label      lblCurrent = e.Item.FindControl("lblCurrentPage") as Label;
            Label      lblCount   = e.Item.FindControl("lblCount") as Label;
            LinkButton lbtnFirst  = e.Item.FindControl("lbtnFirst") as LinkButton;
            LinkButton lbtnPre    = e.Item.FindControl("lbtnPre") as LinkButton;
            LinkButton lbtnNext   = e.Item.FindControl("lbtnNext") as LinkButton;
            LinkButton lbtnLast   = e.Item.FindControl("lbtnLast") as LinkButton;

            lblCurrent.Text = "第" + (pds.CurrentPageIndex + 1).ToString() + "页";
            lblCount.Text   = "共" + pds.PageCount.ToString() + "页";
            if (pds.IsFirstPage)
            {
                lbtnFirst.Enabled = false;
                lbtnPre.Enabled   = false;
            }
            if (pds.IsLastPage)
            {
                lbtnNext.Enabled = false;
                lbtnLast.Enabled = false;
            }
        }
        else
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataList dlPhoneInShop = (DataList)e.Item.FindControl("dlPhoneInShop");

                string ShopId = dlShop.DataKeys[e.Item.ItemIndex].ToString().Trim();

                if (ShopId != "")
                {
                    BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                    DataTable phoneDT = phoneDA.GetHotByShopId(long.Parse(ShopId));
                    if (phoneDT.Rows.Count > 0)
                    {
                        dlPhoneInShop.DataSource = phoneDT;
                        dlPhoneInShop.DataBind();
                    }
                }
            }
        }
    }
Exemplo n.º 3
0
    protected void dlShop_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Footer)
        {
            Label lblCurrent = e.Item.FindControl("lblCurrentPage") as Label;
            Label lblCount = e.Item.FindControl("lblCount") as Label;
            LinkButton lbtnFirst = e.Item.FindControl("lbtnFirst") as LinkButton;
            LinkButton lbtnPre = e.Item.FindControl("lbtnPre") as LinkButton;
            LinkButton lbtnNext = e.Item.FindControl("lbtnNext") as LinkButton;
            LinkButton lbtnLast = e.Item.FindControl("lbtnLast") as LinkButton;

            lblCurrent.Text = "第" + (pds.CurrentPageIndex + 1).ToString() + "页";
            lblCount.Text = "共" + pds.PageCount.ToString() + "页";
            if (pds.IsFirstPage)
            {
                lbtnFirst.Enabled = false;
                lbtnPre.Enabled = false;
            }
            if (pds.IsLastPage)
            {
                lbtnNext.Enabled = false;
                lbtnLast.Enabled = false;
            }
        }
        else
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataList dlPhoneInShop = (DataList)e.Item.FindControl("dlPhoneInShop");

                string ShopId = dlShop.DataKeys[e.Item.ItemIndex].ToString().Trim();

                if (ShopId != "")
                {
                    BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                    DataTable phoneDT = phoneDA.GetHotByShopId(long.Parse(ShopId));
                    if (phoneDT.Rows.Count > 0)
                    {
                        dlPhoneInShop.DataSource = phoneDT;
                        dlPhoneInShop.DataBind();
                    }
                }
            }
        }
    }
Exemplo n.º 4
0
    private void BindDatalist(int currentpage)
    {
        pds.AllowPaging = true;
        pds.PageSize = 8;
        pds.CurrentPageIndex = currentpage;

        if (Session["ShopId"] != null)
        {
            BuyerDSTableAdapters.View_Phone_ShopTableAdapter HotPhoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
            DataTable HotPhoneDT = HotPhoneDA.GetHotByShopId(long.Parse(Session["ShopId"].ToString()));
            if (HotPhoneDT.Rows.Count != 0)
            {
                lblShopName.Text = HotPhoneDT.Rows[0][22].ToString();
                imgShopLogo.ImageUrl = HotPhoneDT.Rows[0][29].ToString();
                for (int i = 0; i < HotPhoneDT.Rows.Count; i++)
                {
                    switch (i)
                    {
                        case 0:
                            {
                                img1.ImageUrl = HotPhoneDT.Rows[i][16].ToString();
                                lbtnName1.Text = HotPhoneDT.Rows[i][1].ToString();
                                lbtnName1.CommandArgument = HotPhoneDT.Rows[i][0].ToString();
                                break;
                            }
                        case 1:
                            {
                                img2.ImageUrl = HotPhoneDT.Rows[i][16].ToString();
                                lbtnName2.Text = HotPhoneDT.Rows[i][1].ToString();
                                lbtnName2.CommandArgument = HotPhoneDT.Rows[i][0].ToString();
                                break;
                            }
                        case 2:
                            {
                                img3.ImageUrl = HotPhoneDT.Rows[i][16].ToString();
                                lbtnName3.Text = HotPhoneDT.Rows[i][1].ToString();
                                lbtnName3.CommandArgument = HotPhoneDT.Rows[i][0].ToString();
                                break;
                            }
                    }
                }
            }
            BuyerDSTableAdapters.View_Phone_ShopTableAdapter AllPhoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
            DataTable AllPhoneDT = AllPhoneDA.GetDataByShopId(long.Parse(Session["ShopId"].ToString()));
            if (AllPhoneDT.Rows.Count != 0)
            {
                pds.DataSource = AllPhoneDT.DefaultView;
                dlPhone.DataSource = pds;
                dlPhone.DataBind();
            }
        }
    }