protected void EditOkButton_Clicked(object sender, EventArgs e)
    {
        if (SelectedView == ViewMode.LinkSuggestion)
        {
            int linkSuggestionRef;
            if (this.ViewState["EditLinkSuggestionRef"] is int)
            {
                linkSuggestionRef = (int)this.ViewState["EditLinkSuggestionRef"];
                LinkSuggestion linkSuggestion = LinkSuggestion.GetOne(linkSuggestionRef);
                linkSuggestion.Description = LinkSuggestionDescriptionTextBox.Text;
                linkSuggestion.LinkUrl     = LinkSuggestionUrlTextBox.Text;
                linkSuggestion.CategoryRef = int.Parse(LinkSuggestionCategoryDropdownList.SelectedValue);
                linkSuggestion.Save();

                this.ViewState.Remove("EditLinkSuggestionRef");
            }
        }
        else if (SelectedView == ViewMode.LinkAdministration)
        {
            int linkRef;
            if (this.ViewState["EditLinkRef"] is int)
            {
                linkRef = (int)this.ViewState["EditLinkRef"];
                DateTime linkDate;
                DateTime linkTime;
                int      categoryRef, clicks;
                int?     userRef = null;
                double   rating;

                try
                {
                    linkDate = DateHandler.ParseDateString(LinkDateTextBox.Text);
                    linkTime = DateHandler.ParseTimeString(LinkTimeTextBox.Text);
                    linkDate = linkDate.Add(linkTime.TimeOfDay);

                    categoryRef = int.Parse(LinkCategoryDropdownList.SelectedValue);
                    clicks      = int.Parse(LinkClicksTextBox.Text);
                    rating      = double.Parse(LinkRatingTextBox.Text);
                    userRef     = int.Parse(LinkUserDropDownList.SelectedValue);
                    if (userRef == 0)
                    {
                        userRef = null;
                    }
                }
                catch { return; }

                Link link;
                if (linkRef > 0)
                {
                    link = Link.GetOne(linkRef);
                }
                else
                {
                    link = new Link();
                }
                if (link == null)
                {
                    return;
                }

                link.CategoryRef = categoryRef;
                link.Clicks      = clicks;
                link.LinkDate    = linkDate;
                link.LinkName    = LinkNameTextBox.Text;
                link.LinkUrl     = LinkUrlTextBox.Text;
                link.Rating      = rating;
                link.UserRef     = userRef;

                link.Save();

                this.ViewState.Remove("EditLinkRef");
            }
        }
        EditLinkSuggestionPanel.Visible = false;
        EditLinkPanel.Visible           = false;
        base.HideModalBackground();
    }