Exemple #1
0
        /// <summary>
        /// Criação dos controlos filhos do OWTabStrip
        /// </summary>
        protected override void CreateChildControls()
        {
            if (TabStripItems != null)
            {
                if (TabStripItems.Count > 0)
                {
                    div = new HtmlGenericControl("div");

                    div.Attributes.Add("class", "taMenu");

                    this.Controls.Add(div);

                    HtmlGenericControl ul = new HtmlGenericControl("ul");

                    div.Controls.Add(ul);

                    foreach (OWTabStripItem item in TabStripItems)
                    {
                        HtmlGenericControl li = new HtmlGenericControl("li");

                        ul.Controls.Add(li);

                        if (item.Selected)
                        {
                            li.ID = "current";
                        }
                        else
                        {
                            li.ID = "";
                        }

                        OWLinkButton link = new OWLinkButton();

                        link.Click += new EventHandler(this.TabClick);

                        li.Controls.Add(link);

                        HtmlGenericControl span = new HtmlGenericControl("span");

                        span.InnerText = item.Description;

                        link.Controls.Add(span);
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Tratamento do evento de criação de um item
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnItemCreated(object sender, DataGridItemEventArgs e)
        {
            if (e != null && e.Item != null)
            {
                //----------------------------------------------------------------
                // Criação de uma referência para o Header da grid
                //----------------------------------------------------------------
                if (e.Item.ItemType == ListItemType.Header)
                {
                    this.HeaderItem = e.Item;
                }

                //----------------------------------------------------------------
                // - Criação de uma referência para o Footer da grid
                // - Criação de linhas em Lopes no fim da lista para para preencher
                //   o número de linhas do tamanho da página
                //----------------------------------------------------------------
                if (e.Item.ItemType == ListItemType.Footer)
                {
                    this.FooterItem = e.Item;

                    if (this.AllwaysShowBlankRows)
                    {
                        this.AddBlankRows();
                    }
                    else
                    if (this.ShowBlankRows && this.AllowPaging)
                    {
                        this.AddBlankRows();
                    }
                }

                //----------------------------------------------------------------
                // Tratamento do item Pager
                //----------------------------------------------------------------
                if (e.Item.ItemType == ListItemType.Pager && this.BuiltInPaging)
                {
                    //Maintable
                    HtmlTable maintable = new HtmlTable();
                    maintable.Rows.Add(new HtmlTableRow());
                    maintable.Width = "100%";

                    maintable.Rows[0].Cells.Add(new HtmlTableCell());
                    maintable.Rows[0].Cells.Add(new HtmlTableCell());
                    maintable.Rows[0].Cells.Add(new HtmlTableCell());

                    maintable.Rows[0].Cells[0].Width = "33%";
                    maintable.Rows[0].Cells[1].Width = "33%";
                    maintable.Rows[0].Cells[2].Width = "33%";

                    //Paginator table
                    HtmlTable table = new HtmlTable();
                    table.Rows.Add(new HtmlTableRow());
                    table.Align = "center";

                    table.Rows[0].Cells.Add(new HtmlTableCell());
                    table.Rows[0].Cells.Add(new HtmlTableCell());
                    table.Rows[0].Cells.Add(new HtmlTableCell());
                    table.Rows[0].Cells.Add(new HtmlTableCell());
                    table.Rows[0].Cells.Add(new HtmlTableCell());
                    table.Rows[0].Cells.Add(new HtmlTableCell());

                    OWLinkButton First    = new OWLinkButton();
                    OWLinkButton Previous = new OWLinkButton();
                    OWLinkButton Next     = new OWLinkButton();
                    OWLinkButton Last     = new OWLinkButton();

                    First.CausesValidation    = false;
                    Previous.CausesValidation = false;
                    Next.CausesValidation     = false;
                    Last.CausesValidation     = false;

                    First.Click    += new EventHandler(this.OnClickFirst);
                    Previous.Click += new EventHandler(this.OnClickPrevious);
                    Next.Click     += new EventHandler(this.OnClickNext);
                    Last.Click     += new EventHandler(this.OnClickLast);

                    First.Text    = "<<";
                    Previous.Text = "<";
                    Next.Text     = ">";
                    Last.Text     = ">>";

                    int pageNumber = this.CurrentPageIndex + 1;
                    int pageCount  = this.PageCount;

                    //Show buttons if not in first page
                    if (pageNumber > 1)
                    {
                        table.Rows[0].Cells[0].Controls.Add(First);
                        table.Rows[0].Cells[1].Controls.Add(Previous);
                    }
                    //Pages info
                    if (ResX.GetSelectedCulture().StartsWith("pt"))
                    {
                        table.Rows[0].Cells[2].InnerText = string.Format("Página {0} de {1}", pageNumber, (pageCount == 0?1:pageCount));
                    }
                    else
                    {
                        table.Rows[0].Cells[2].InnerText = string.Format("Page {0} of {1}", pageNumber, (pageCount == 0?1:pageCount));
                    }

                    //Show buttons if pages exists or not in last page
                    if (pageNumber != pageCount && pageCount != 0)
                    {
                        table.Rows[0].Cells[3].Controls.Add(Next);
                        table.Rows[0].Cells[4].Controls.Add(Last);
                    }

                    //End of paginator table

                    //Add paginator table to maintable
                    maintable.Rows[0].Cells[1].Controls.Clear();
                    maintable.Rows[0].Cells[1].Controls.Add(table);

                    //Add total of records to maintable
                    maintable.Rows[0].Cells[2].InnerText = "Total: " + this.rowCount.ToString();
                    maintable.Rows[0].Cells[2].Attributes.Add("align", "right");

                    //Add navigator table
                    e.Item.Controls[0].Controls.Clear();
                    e.Item.Controls[0].Controls.AddAt(0, maintable);
                }
            }
        }