private ICollection mountDataList()
        {
            EnhancedLinkDB enhancedLinks = new EnhancedLinkDB();
            SqlDataReader  dr            = enhancedLinks.GetEnhancedLinks(ModuleID, Version);
            DataTable      dt            = new DataTable();

            dt.Columns.Add(new DataColumn("TextField", typeof(string)));
            dt.Columns.Add(new DataColumn("ValueField", typeof(string)));
            if (IsEditable)
            {
                dt.Rows.Add(CreateRow(Esperantus.Localize.GetString("ENHANCEDLINKS_EDITLINK", "Edit Link", null), string.Empty, dt));
            }
            else
            {
                dt.Rows.Add(CreateRow(ModuleTitle.Title, string.Empty, dt));
            }
            while (dr.Read())
            {
                string linkStr = (string)dr["Url"];
                if (!linkStr.Equals("SEPARATOR"))
                {
                    dt.Rows.Add(CreateRow((string)dr["Title"], dr["ItemID"].ToString(), dt));
                }
            }
            DataView dv = new DataView(dt);

            return(dv);
        }
        /// <summary>
        /// The DeleteBtn_Click event handler on this Page is used to delete
        /// a link.  It  uses the Rainbow.EnhancedLinkDB()
        /// data component to encapsulate all data functionality.
        /// </summary>
        override protected void OnDelete(EventArgs e)
        {
            base.OnDelete(e);

            // Only attempt to delete the item if it is an existing item
            // (new items will have "ItemID" of 0)
            if (ItemID != 0)
            {
                EnhancedLinkDB enhancedLinks = new EnhancedLinkDB();
                enhancedLinks.DeleteEnhancedLink(ItemID);
            }

            // Redirect back to the portal home page
            this.RedirectBackToReferringPage();
        }
        /// <summary>
        /// The Page_Load event on this Page is used to obtain the
        /// ItemID of the link to edit.
        /// It then uses the Rainbow.EnhancedLinkDB() data component
        /// to populate the page's edit controls with the links details.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            Src.FileNameOnly    = true;
            Src.PreselectedFile = Src.Text;
            Src.UploadDirectory = portalSettings.PortalFullPath + "/" + moduleSettings["ENHANCEDLINKS_ICONPATH"].ToString();

            if (!Page.IsPostBack)
            {
                TargetField.Items.Add("_new");
                TargetField.Items.Add("_blank");
                TargetField.Items.Add("_parent");
                TargetField.Items.Add("_self");
                TargetField.Items.Add("_top");

                if (ItemID != 0)
                {
                    // Obtain a single row of link information
                    EnhancedLinkDB enhancedLinks = new EnhancedLinkDB();
                    SqlDataReader  dr            = enhancedLinks.GetSingleEnhancedLink(ItemID, WorkFlowVersion.Staging);

                    // Read in first row from database
                    if (dr.Read())
                    {
                        TitleField.Text       = (string)dr["Title"];
                        DescriptionField.Text = (string)dr["Description"];
                        UrlField.Text         = (string)dr["Url"];
                        Src.Text            = (string)dr["ImageUrl"];
                        MobileUrlField.Text = dr["MobileUrl"].ToString();
                        ViewOrderField.Text = dr["ViewOrder"].ToString();
                        CreatedBy.Text      = (string)dr["CreatedByUser"];
                        CreatedDate.Text    = ((DateTime)dr["CreatedDate"]).ToShortDateString();
                        TargetField.Items.FindByText((string)dr["Target"]).Selected = true;
                        IsGroup.Checked = UrlField.Text.Equals("SEPARATOR");
                        if (UrlField.Text.Equals("SEPARATOR"))
                        {
                            oldUrl.Text = string.Empty;
                        }
                        else
                        {
                            oldUrl.Text = UrlField.Text;
                        }
                        estableceVisibilidad();
                    }
                    // Close datareader
                    dr.Close();
                }
            }
        }
        private void cmdGo(object sender, System.EventArgs e)
        {
            string auxItem = cboLinks.SelectedItem.Value;

            cboLinks.SelectedIndex = 0;
            if (IsEditable)
            {
                Response.Redirect(GetLinkUrl(auxItem, null, true), true);
            }
            else
            {
                string         strURL        = string.Empty;
                EnhancedLinkDB enhancedLinks = new EnhancedLinkDB();
                SqlDataReader  dr            = enhancedLinks.GetSingleEnhancedLink(Int32.Parse(auxItem), Version);
                if (dr.Read())
                {
                    strURL = dr["Url"].ToString();
                }
                dr.Close();
                Response.Redirect(GetLinkUrl(null, strURL, false), true);
            }
        }
        /// <summary>
        /// The UpdateBtn_Click event handler on this Page is used to either
        /// create or update a link.  It  uses the Rainbow.EnhancedLinkDB()
        /// data component to encapsulate all data functionality.
        /// </summary>
        override protected void OnUpdate(EventArgs e)
        {
            base.OnUpdate(e);

            if (Page.IsValid == true)
            {
                // Create an instance of the EnhancedLink DB component
                EnhancedLinkDB enhancedLinks = new EnhancedLinkDB();

                if (ItemID == 0)
                {
                    // Add the link within the Links table
                    enhancedLinks.AddEnhancedLink(ModuleID, ItemID, PortalSettings.CurrentUser.Identity.Email, TitleField.Text, UrlField.Text, MobileUrlField.Text, Int32.Parse(ViewOrderField.Text), DescriptionField.Text, Src.Text, 0, TargetField.SelectedItem.Text);
                }
                else
                {
                    // Update the link within the Links table
                    enhancedLinks.UpdateEnhancedLink(ModuleID, ItemID, PortalSettings.CurrentUser.Identity.Email, TitleField.Text, UrlField.Text, MobileUrlField.Text, Int32.Parse(ViewOrderField.Text), DescriptionField.Text, Src.Text, 0, TargetField.SelectedItem.Text);
                }

                // Redirect back to the portal home page
                this.RedirectBackToReferringPage();
            }
        }
        /// <summary>
        /// The Page_Load event handler on this User Control is used to
        /// obtain a DataReader of link information from the EnhancedLinks
        /// table, and then databind the results to a templated DataList
        /// server control.  It uses the Rainbow.EnhancedLinkDB()
        /// data component to encapsulate all data functionality.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            string iconContainer = Settings["ENHANCEDLINKS_ICONPATH"].ToString();
            string defaultImage  = Settings["ENHANCEDLINKS_DEFAULTIMAGE"].ToString();
            bool   dropDownList  = Settings["ENHANCEDLINKS_SWITCHERTYPES"].ToString().Equals("1");
            bool   doExpandAll   = bool.Parse(Settings["ENHANCEDLINKS_EXPANDALL"].ToString());
            int    maxColumns    = int.Parse(Settings["ENHANCEDLINKS_MAXCOLUMS"].ToString());
            int    actualColumn  = 1;

            if (dropDownList)
            {
                if (!Page.IsPostBack)
                {
                    results.Visible         = false;
                    cboLinks.Visible        = true;
                    cboLinks.DataSource     = mountDataList();
                    cboLinks.DataTextField  = "TextField";
                    cboLinks.DataValueField = "ValueField";
                    cboLinks.SelectedIndex  = 0;
                    cboLinks.DataBind();
                }
                return;
            }
            int            itemCount     = 0;
            EnhancedLinkDB enhancedLinks = new EnhancedLinkDB();
            StringBuilder  listStr       = new StringBuilder();

            listStr.Append("<table border=0 cellspacing=5 cellpadding=0>");
            SqlDataReader dr = enhancedLinks.GetEnhancedLinks(ModuleID, Version);

            listStr.Append("<tr>");

            while (dr.Read())
            {
                string imageStr    = (string)dr["ImageURL"];
                string linkStr     = (string)dr["Url"];
                string titleStr    = (string)dr["Title"];
                string descStr     = (string)dr["Description"];
                string targetStr   = (string)dr["Target"];
                bool   isSeparator = linkStr.Equals("SEPARATOR");

                if (isSeparator)
                {
                    listStr.Append("<td>&nbsp;</td></tr><tr>");
                    actualColumn = 1;
                }
                if (IsEditable)
                {
                    listStr.Append("<td><a href=\"" + GetLinkUrl(dr["ItemID"].ToString(), linkStr, true) + "\"><img src='" + this.CurrentTheme.GetImage("Buttons_Edit", "Edit.gif").ImageUrl + "' border=0></a>&nbsp;</td>");
                }
                string auxImage;
                if ((imageStr != null) && (imageStr.Length > 0))
                {
                    auxImage = this.portalSettings.PortalFullPath + "/" + iconContainer + "/" + imageStr;
                }
                else if ((defaultImage != null) && (defaultImage.Length > 0))
                {
                    auxImage = this.portalSettings.PortalFullPath + "/" + iconContainer + "/" + defaultImage;
                }
                else
                {
                    auxImage = this.CurrentTheme.GetImage("NavLink", "navlink.gif").ImageUrl;
                }
                string altStr = string.Empty;
                if ((descStr != null) && (descStr.Length > 0))
                {
                    altStr = " title='" + descStr + "'";
                }
                targetStr = " target='" + targetStr + "'";
                listStr.Append("<td valign=center align=center><img src='" + auxImage + "' border=0></td>");
                if (isSeparator)
                {
                    listStr.Append("<td valign=center><a class='EnhancedTitle'>" + titleStr + "</a></td></tr><tr><td colspan=40><hr></td></tr><tr>");
                }
                else
                {
                    listStr.Append("<td valign=center><a class='EnhancedLink' href='" + GetLinkUrl(null, linkStr, false) + "'" + targetStr + altStr + ">" + titleStr + "</a>");
                    if ((doExpandAll) && (descStr != null) && (descStr.Length > 0))
                    {
                        listStr.Append("<br>" + "<a class='EnhancedDescription'>" + descStr + "</a>");
                    }
                }
                if (!isSeparator)
                {
                    listStr.Append("</td>");
                    if (actualColumn < maxColumns)
                    {
                        listStr.Append("<td>&nbsp;</td>");
                        actualColumn++;
                    }
                    else
                    {
                        listStr.Append("</tr>");
                        actualColumn = 1;
                    }
                }
                itemCount++;
            }
            dr.Close();

            listStr.Append("</tr>");
            listStr.Append("</table>\r\n");

            if (itemCount > 0)
            {
                results.Visible = true;
                results.Controls.Add(ParseControl(listStr.ToString()));
            }
        }