protected void Page_Load(object sender, EventArgs e)
    {
        //Add ddl
        tblPortfolioGroupCollection GroupTbl = new tblPortfolioGroupCollection();

        GroupTbl.ReadList();

        if (!IsPostBack)
        {
            for (int i = 0; i < GroupTbl.Count; i++)
            {
                ddlPortfolioGroup.Items.Add(new ListItem(GroupTbl[i].groupTitle, GroupTbl[i].id.ToString()));
            }
        }
        //place data
        string infoString = string.Empty;
        tblPortfolioCompanyCollection detTbl = new tblPortfolioCompanyCollection();

        detTbl.ReadList();

        string addRow     = "<div class='row'>";
        int    countSteps = 0;

        for (int i = 0; i < detTbl.Count; i++)
        {
            GroupTbl.ReadList(Criteria.NewCriteria(tblPortfolioGroup.Columns.id, CriteriaOperators.Equal, detTbl[i].idGroup));

            if (countSteps == 0)
            {
                infoString += addRow;
            }

            infoString += "<div class='col-md-6 graph-2'>" +
                          "<h3 class='inner-tittle'>Information " + (i + 1) + " </h3>" +
                          "<div class='panel panel-primary two'>" +
                          "<div class='panel-heading'>" + detTbl[i].title + "(" + GroupTbl[0].groupTitle + ")" + "</div><div class='panel-body ont two'>" +
                          "<div><img src='" + detTbl[i].picAddr + detTbl[i].picName + "' alt='" + detTbl[i].picName + "' style='width: 100%;' /></div>" +
                          "<p>" + detTbl[i].details + "</p><h5>Date: " + detTbl[i].implimentationDate + "</h5></div>" +
                          "<div class='panel-footer'><a href='portfolio-company-details.aspx?item=" + detTbl[i].id + "'>edit</a></div></div></div>";
            countSteps++;
            if (countSteps == 2)
            {
                countSteps  = 0;
                infoString += "</div>";
            }
        }

        infHtml.InnerHtml = infoString;
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        int idElement = 0;

        if (Request.Cookies["idElement"] != null)
        {
            idElement = Int32.Parse(Request.Cookies["idElement"].Value);
        }

        tblPortfolioGroupCollection portfolioGroupTbl = new tblPortfolioGroupCollection();

        portfolioGroupTbl.ReadList(Criteria.NewCriteria(tblPortfolioGroup.Columns.id, CriteriaOperators.Equal, idElement));

        if (txtTitleUpdate.Text.Trim().Length > 0)
        {
            portfolioGroupTbl[0].groupTitle = txtTitleUpdate.Text;
        }
        else
        {
            lblError.Visible = true;
        }

        portfolioGroupTbl[0].groupDetails = txtDetailUpdate.Text;

        if (lblError.Visible == false)
        {
            portfolioGroupTbl[0].Update();
            Response.Redirect("portfolio-group.aspx");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //kill cookies
        if (!IsPostBack)
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "myfunction", "killCookie();", true);
        }



        string itemsString     = string.Empty;
        string popupPageString = string.Empty;

        tblPortfolioGroupCollection portfolioGroupTbl = new tblPortfolioGroupCollection();

        portfolioGroupTbl.ReadList();

        for (int i = 0; i < portfolioGroupTbl.Count; i++)
        {
            itemsString += "<div class='popup panel-footer'>" +
                           (i + 1) + "- <a id=\"" + portfolioGroupTbl[i].id + "\" href=\"javascript:__doPostBack('ctl00$ctl00$ContentPlaceHolder1$ContentPlaceHolder2$LinkButton" + portfolioGroupTbl[i].id + "','')\" Class='clickable'>" + portfolioGroupTbl[i].groupTitle + "</a><br />" +
                           "</div";
        }

        itemsHtml.InnerHtml = itemsString;
    }
    protected void btnDel_Click(object sender, EventArgs e)
    {
        int idElement = 0;

        if (Request.Cookies["idElement"] != null)
        {
            idElement = Int32.Parse(Request.Cookies["idElement"].Value);
        }

        tblPortfolioGroupCollection portfolioGroupTbl = new tblPortfolioGroupCollection();

        portfolioGroupTbl.ReadList(Criteria.NewCriteria(tblPortfolioGroup.Columns.id, CriteriaOperators.Equal, idElement));

        portfolioGroupTbl[0].Delete();

        Response.Redirect("portfolio-group.aspx");
    }
    protected void lbUpdate_Click(object sender, EventArgs e)
    {
        int idElement = 0;

        if (Request.Cookies["idElement"] != null)
        {
            idElement = Int32.Parse(Request.Cookies["idElement"].Value);
        }

        tblPortfolioGroupCollection portfolioGroupTbl = new tblPortfolioGroupCollection();

        portfolioGroupTbl.ReadList(Criteria.NewCriteria(tblInformationGroup.Columns.id, CriteriaOperators.Equal, idElement));

        lblTitle.Text = portfolioGroupTbl[0].groupTitle;

        txtTitleUpdate.Text  = portfolioGroupTbl[0].groupTitle;
        txtDetailUpdate.Text = portfolioGroupTbl[0].groupDetails;

        ScriptManager.RegisterStartupScript(this, GetType(), "myfunction", "open();", true);
    }