コード例 #1
0
        private void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.IsPostBack)
                {
                    this.TitleTextBox.Focus();
                    var slide = this.SlideId.HasValue
                        ? Slide.GetSlide(this.SlideId.Value)
                        : null;

                    if (slide != null)
                    {
                        this.LoadSlide(slide);
                    }
                    else
                    {
                        this.StartDateTextBox.Text = DateTime.Today.ToShortDateString();

                        // 5 is database default
                        this.SortOrderTextBox.Text = 5.ToString(CultureInfo.InvariantCulture);
                    }

                    var templateInfo = this.GetTemplate(ModuleSettings.TemplateFolderName.GetValueAsStringFor(this));
                    var placeholders = TemplateEngine.GetPlaceholders(templateInfo.Template.ChildTags).Where(placeholder => placeholder.Type == TemplatePlaceholderType.DataBinding).ToArray();
                    SetPropertyVisibility(placeholders, this.TitlePanel, "TITLE");
                    SetPropertyVisibility(placeholders, this.ContentPanel, "CONTENT");
                    SetPropertyVisibility(placeholders, this.ImageUrlPanel, "IMAGEURL", "IMAGE URL");
                    SetPropertyVisibility(placeholders, this.PagerImageUrlPanel, "PAGERIMAGEURL", "PAGER IMAGE URL");
                    SetPropertyVisibility(placeholders, this.LinkUrlPanel, "LINKURL", "LINK URL");
                }

                this.RegisterDatePickerBehavior();
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }