Ejemplo n.º 1
0
    protected void Acc_OnItemDataBound(object sender, AccordionItemEventArgs e)
    {
        Label    lbltitle = null;
        DataView dview;

        if (e.ItemType == AccordionItemType.Header)
        {
            lbltitle = e.AccordionItem.FindControl("lbltitle")  as Label;
            ViewState["LblTitle"] = lbltitle.Text;
            if (lbltitle.Text == "")
            {
                lbltitle.Text           = "Divisional Documents";
                lbltitle.Font.Underline = true;
            }
        }
        if (e.ItemType == AccordionItemType.Content)
        {
            GridView gv = e.AccordionItem.FindControl("gv")  as GridView;
            if (Convert.ToString(ViewState["LblTitle"]) != "")
            {
                dview         = (ViewState["dsTable"] as DataTable).Select("Productline_Desc ='" + ViewState["LblTitle"].ToString() + "'").CopyToDataTable().DefaultView;
                gv.DataSource = dview.ToTable(false, new string[] { "Document", "Uploaded Date", "Product Group" });
                gv.DataBind();
            }
            else
            {
                dview         = (ViewState["dsTable"] as DataTable).Select("Productline_Desc is null").CopyToDataTable().DefaultView;
                gv.DataSource = dview.ToTable(false, new string[] { "Document", "Uploaded Date", "Product Group" });
                gv.DataBind();
            }
        }
    }
Ejemplo n.º 2
0
        protected void accAssociations_ItemDataBound(object sender, AccordionItemEventArgs e)
        {
            FIFAAssociation curAss = e.AccordionItem.DataItem as FIFAAssociation;

            if (e.AccordionItem.ItemType == AccordionItemType.Header)
            {
                Label lblCount       = e.AccordionItem.FindControl("lblCount") as Label;
                int   countriesCount = _countryCache.Where(c => c.FIFAAssociation_ID == curAss.FIFAAssociation_ID).Count();
                switch (countriesCount)
                {
                case 0:
                    lblCount.Text = "0 стран"; break;

                case 1:
                    lblCount.Text = "1 страна"; break;

                case 2:
                case 3:
                case 4:
                    lblCount.Text = countriesCount.ToString() + " страны"; break;

                default:
                    lblCount.Text = countriesCount.ToString() + " стран"; break;
                }
            }

            if (e.AccordionItem.ItemType == AccordionItemType.Content)
            {
                Repeater rptCountries = e.AccordionItem.FindControl("rptCountries") as Repeater;
                rptCountries.DataSource = _countryCache.Where(c => c.FIFAAssociation_ID == curAss.FIFAAssociation_ID).OrderBy(c => c.Country_Name);
                rptCountries.DataBind();
            }
        }