protected void CreateNewItemButton_OnClick(object sender, EventArgs e)
        {
            Guid defaultSiteId       = Guid.Empty;
            var  defaultFrontendSite = SiteManagementContext.GetSiteToManage();

            if (defaultFrontendSite != null)
            {
                defaultSiteId = defaultFrontendSite.ContentId;
            }


            var uriBuilder = new CmsUriBuilder();
            var editPage   = new CmsPageRepository()
                             .FindContentVersions(By.ContentId(Config.AddPage), ContentEnvironment.Live)
                             .Result
                             .Single();

            var defaultValues = new DefaultValueCollection {
                ["SiteId"] = defaultSiteId.ToString()
            };
            var newPageUri = uriBuilder.CreateUri(editPage, UriSettings.Default, new Dictionary <string, string>
            {
                [nameof(DynamicFormRequestContext.DefaultValues)] = defaultValues.ToString()
            });

            Response.Redirect(newPageUri.PathAndQuery);
        }
Beispiel #2
0
        public SerializationContext()
        {
            _outputTypeComment = true;
            _outputTypeInformation = true;
            _referenceWritingType = ReferenceOption.ErrorCircularReferences;

            _typeAliases = new TypeAliasCollection();

            // collections
            _collectionHandlers = new List<CollectionHandler>();
            _collectionHandlers.Add(new GenericCollectionHandler());
            _collectionHandlers.Add(new ArrayHandler());
            _collectionHandlers.Add(new ListHandler());
            _collectionHandlers.Add(new StackHandler());
            _collectionHandlers.Add(new GenericStackHandler());
            _collectionHandlers.Add(new CollectionConstructorHandler());

            // type handlers
            _typeHandlerFactory = new TypeDataRepository(this);
            _parameters = new Hashtable();

            // type conversion
            _typeHandlerFactory.RegisterTypeConverter(typeof(System.Collections.BitArray), new BitArrayConverter());

            this.expressionHandlers = new ExpressionHandlerCollection(this);
            this.defaultValues = new DefaultValueCollection();
        }