Ejemplo n.º 1
0
        /// <summary>
        /// Creates the cell.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns></returns>
        private TableCell CreateCell(KefMenuItem item)
        {
            TableCell cell = new TableCell();
              Image img = new Image();
              img.ImageAlign = ImageAlign.AbsMiddle;
              //HtmlGenericControl div = new HtmlGenericControl();
              //div.TagName = "div";
              //cell.Controls.Add(div);
              bool selected = (item.Index == m_selectedindex);
              if (selected)
              {
            img.ImageUrl = item.ImageUrlL;
            img.Width = Unit.Pixel(48);
            img.Height = Unit.Pixel(48);
            Label lbl = new Label();
            lbl.Text = item.Description;
            cell.Controls.Add(img);
            cell.Controls.Add(lbl);
            cell.CssClass = "aktiv";
            cell.VerticalAlign = VerticalAlign.Middle;
              }
              else
              {
            img.ImageUrl = item.ImageUrlS;
            img.Width = Unit.Pixel(16);
            img.Height = Unit.Pixel(16);
            HyperLink link = new HyperLink();
            link.Text = item.Title;
            link.ToolTip = item.Description;
            link.NavigateUrl = item.Url;
            cell.Controls.Add(img);
            cell.Controls.Add(link);
            cell.CssClass = "inaktiv";
            cell.VerticalAlign = VerticalAlign.Middle;
              }
              //div.Controls.Add(img);

              return cell;
        }
Ejemplo n.º 2
0
        //public
        /// <summary> 
        /// Render this control to the output parameter specified.
        /// </summary>
        /// <param name="output"> The HTML writer to write out to </param>
        protected override void Render(HtmlTextWriter output)
        {
            string id = "";
              id = this.Page.Request["ID"];

              KefMenuItem item0 =
            new KefMenuItem(0, "Bemutatkozás", "Bemutatkozás", "Kef.aspx?ID=" + id, "_images/introS.gif",
                        "_images/introL.gif");
              ////EZ nek kell
              //KefMenuItem item1 =
              //  new KefMenuItem(1, "A térségrõl", "A térségrõl", "KefArea.aspx?ID=" + id, "_images/mapS.gif",
              //                  "_images/mapL.gif");
              KefMenuItem item2 =
            new KefMenuItem(2, "KEF tagok", "Tagjaink", "KefMembers.aspx?ID=" + id, "_images/membersS.gif",
                        "_images/membersL.gif");
              KefMenuItem item3 =
            new KefMenuItem(3, "Helyi stratégia", "Helyi stratégia", "KefDrogStrategy.aspx?ID=" + id, "_images/stratS.gif",
                        "_images/stratL.gif");
              KefMenuItem item4 =
            new KefMenuItem(4, "Egyéb dokumentumok", "Egyéb dokumentumok", "KefOtherDocs.aspx?ID=" + id, "_images/docS.gif",
                        "_images/docL.gif");
              KefMenuItem item5 =
            new KefMenuItem(5, "Események", "Események", "KefEvents.aspx?ID=" + id, "_images/eventsS.gif",
                        "_images/eventsL.gif");
              KefMenuItem item6 =
            new KefMenuItem(6, "(SZIP)", "Szakmai Információs Portál (SZIP)", "SzipKef.aspx?ID=" + id, "_images/szipS.gif",
                        "_images/szipL.gif");

              Table table = new Table();
              table.CellPadding = 0;
              table.CellSpacing = 0;
              table.CssClass = "almenu";
              TableRow row1 = new TableRow();
              TableRow row2 = new TableRow();

              //bool visibleKefAreaMenu = false;
              //try
              //{
              //  string visible = ConfigurationManager.AppSettings["KefAreaMenu.Visible"];
              //  if (visible != null && visible.Length > 0)
              //  {
              //    if (!bool.TryParse(visible, out visibleKefAreaMenu))
              //    {
              //      visibleKefAreaMenu = false;
              //    }
              //  }
              //}
              //catch
              //{

              //}
              TableCell cell0 = CreateCell(item0);

              TableCell cell2 = CreateCell(item2);
              TableCell cell3 = CreateCell(item3);
              TableCell cell4 = CreateCell(item4);
              TableCell cell5 = CreateCell(item5);
              TableCell cell6 = CreateCell(item6);
              table.Rows.Add(row2);
              table.Rows.Add(row1);
              if (item0.Index == m_selectedindex)
            row1.Cells.Add(cell0);
              else
            row2.Cells.Add(cell0);

              //if (visibleKefAreaMenu)
              //{
              //  TableCell cell1 = CreateCell(item1);
              //  if (item1.Index == m_selectedindex)
              //    row1.Cells.Add(cell1);
              //  else
              //    row2.Cells.Add(cell1);
              //}
              if (item2.Index == m_selectedindex)
            row1.Cells.Add(cell2);
              else
            row2.Cells.Add(cell2);
              if (item3.Index == m_selectedindex)
            row1.Cells.Add(cell3);
              else
            row2.Cells.Add(cell3);
              if (item4.Index == m_selectedindex)
            row1.Cells.Add(cell4);
              else
            row2.Cells.Add(cell4);
              if (item5.Index == m_selectedindex)
            row1.Cells.Add(cell5);
              else
            row2.Cells.Add(cell5);

              if (Context.User.Identity.IsAuthenticated)
              {
            if (item6.Index == m_selectedindex)
              row1.Cells.Add(cell6);
            else
              row2.Cells.Add(cell6);
              }
              if(row1.Cells != null && row1.Cells.Count> 0 && row2.Cells != null && row2.Cells.Count > 0)
              {
            row1.Cells[0].ColumnSpan = row2.Cells.Count;

              }
              table.Width = Unit.Percentage(100);

              table.RenderControl(output);
        }