示例#1
0
        /// <summary>
        /// Sets the value ( as either Page.Guid,PageRoute.Guid or just Page.Guid if not specific to a route )
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="value">The value.</param>
        public override void SetEditValue(System.Web.UI.Control control, Dictionary <string, ConfigurationValue> configurationValues, string value)
        {
            if (value != null)
            {
                PagePicker ppPage = control as PagePicker;
                if (ppPage != null)
                {
                    string[] valuePair = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                    Page      page      = null;
                    PageRoute pageRoute = null;

                    //// Value is in format "Page.Guid,PageRoute.Guid"
                    //// If only the Page.Guid is specified this is just a reference to a page without a special route
                    //// In case the PageRoute record can't be found from PageRoute.Guid (maybe the pageroute was deleted), fall back to the Page without a PageRoute

                    var rockContext = new RockContext();

                    if (valuePair.Length == 2)
                    {
                        Guid pageRouteGuid;
                        Guid.TryParse(valuePair[1], out pageRouteGuid);
                        pageRoute = new PageRouteService(rockContext).Get(pageRouteGuid);
                    }

                    if (pageRoute != null)
                    {
                        ppPage.SetValue(pageRoute);
                    }
                    else
                    {
                        if (valuePair.Length > 0)
                        {
                            Guid pageGuid;
                            Guid.TryParse(valuePair[0], out pageGuid);
                            page = new PageService(rockContext).Get(pageGuid);
                        }

                        ppPage.SetValue(page);
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // These values need to be reset here because viewstate retains them if their hidden.
            var pushOpenAction = GetSelectedOpenActionOrDefault();

            if (pushOpenAction != PushOpenAction.ShowDetails)
            {
                htmlAdditionalDetails.Text          = null;
                ddlMobileApplications.SelectedValue = null;
            }

            if (pushOpenAction != PushOpenAction.LinkToMobilePage)
            {
                kvlQuerystring.Value = null;
                ppMobilePage.SetValue(( int? )null);
            }

            if (pushOpenAction != PushOpenAction.LinkToUrl)
            {
                urlLink.Text = null;
            }
        }