override protected void OnInit(EventArgs e) { base.OnInit(e); int id = int.Parse(Request.QueryString["id"]); //Loading Media via new public service to ensure that the Properties are loaded correct var media = ApplicationContext.Current.Services.MediaService.GetById(id); _media = new cms.businesslogic.media.Media(media); // Save media on first load bool exists = SqlHelper.ExecuteScalar <int>("SELECT COUNT(nodeId) FROM cmsContentXml WHERE nodeId = @nodeId", SqlHelper.CreateParameter("@nodeId", _media.Id)) > 0; if (!exists) { _media.XmlGenerate(new XmlDocument()); } _contentControl = new controls.ContentControl(_media, controls.ContentControl.publishModes.NoPublish, "TabView1"); _contentControl.Width = Unit.Pixel(666); _contentControl.Height = Unit.Pixel(666); //this must be set to false as we don't want to proceed to save anything if the page is invalid _contentControl.SavePropertyDataWhenInvalid = false; plc.Controls.Add(_contentControl); _contentControl.Save += new System.EventHandler(Save); this._updateDateLiteral.ID = "updateDate"; this._updateDateLiteral.Text = _media.VersionDate.ToShortDateString() + " " + _media.VersionDate.ToShortTimeString(); this._mediaFileLinksLiteral.ID = "mediaFileLinks"; _mediaPropertiesPane.addProperty(ui.Text("content", "updateDate", base.getUser()), this._updateDateLiteral); this.UpdateMediaFileLinksLiteral(); _mediaPropertiesPane.addProperty(ui.Text("content", "mediaLinks"), this._mediaFileLinksLiteral); // add the property pane to the page rendering _contentControl.tpProp.Controls.AddAt(1, _mediaPropertiesPane); }
override protected void OnInit(EventArgs e) { base.OnInit(e); int id = int.Parse(Request.QueryString["id"]); //Loading Media via new public service to ensure that the Properties are loaded correct var media = ApplicationContext.Current.Services.MediaService.GetById(id); _media = new cms.businesslogic.media.Media(media); // Save media on first load bool exists = SqlHelper.ExecuteScalar<int>("SELECT COUNT(nodeId) FROM cmsContentXml WHERE nodeId = @nodeId", SqlHelper.CreateParameter("@nodeId", _media.Id)) > 0; if (!exists) { _media.XmlGenerate(new XmlDocument()); } _contentControl = new controls.ContentControl(_media, controls.ContentControl.publishModes.NoPublish, "TabView1"); _contentControl.Width = Unit.Pixel(666); _contentControl.Height = Unit.Pixel(666); //this must be set to false as we don't want to proceed to save anything if the page is invalid _contentControl.SavePropertyDataWhenInvalid = false; plc.Controls.Add(_contentControl); _contentControl.Save += new System.EventHandler(Save); this._updateDateLiteral.ID = "updateDate"; this._updateDateLiteral.Text = _media.VersionDate.ToShortDateString() + " " + _media.VersionDate.ToShortTimeString(); this._mediaFileLinksLiteral.ID = "mediaFileLinks"; _mediaPropertiesPane.addProperty(ui.Text("content", "updateDate", base.getUser()), this._updateDateLiteral); this.UpdateMediaFileLinksLiteral(); _mediaPropertiesPane.addProperty(ui.Text("content", "mediaLinks"), this._mediaFileLinksLiteral); // add the property pane to the page rendering _contentControl.tpProp.Controls.AddAt(1, _mediaPropertiesPane); }