private ID ParseIdWithError(string value, string fieldName) { if (MainUtil.IsID(value)) { return(ID.Parse(value)); } throw new ArgumentException(fieldName); }
public static bool IsLocalDatasourceItem([NotNull] this Item dataSourceItem) { if (dataSourceItem == null) { throw new ArgumentNullException(nameof(dataSourceItem)); } if (MainUtil.IsID(Settings.LocalDatasourceFolderTemplate)) { return(dataSourceItem.Parent?.TemplateID.Equals(ID.Parse(Settings.LocalDatasourceFolderTemplate)) ?? false); } return(dataSourceItem.Parent?.TemplateName.Equals(Settings.LocalDatasourceFolderTemplate, StringComparison.InvariantCultureIgnoreCase) ?? false); }
private void ParseRenderingDataSource(Rendering rendering) { var dataSource = rendering.DataSource; if (string.IsNullOrWhiteSpace(dataSource)) { dataSource = "+location:" + this.Rendering.Item.ID; } if (MainUtil.IsID(dataSource)) { dataSource = "+location:" + dataSource; } this.DatasourceString = dataSource; }
protected override void OnLoad(EventArgs e) { Assert.ArgumentNotNull(e, "e"); base.OnLoad(e); if (!Context.ClientPage.IsEvent) { if (MainUtil.IsID(HttpUtility.UrlDecode(WebUtil.GetQueryString("itemid")))) { ItemPicker.Value = HttpUtility.UrlDecode(WebUtil.GetQueryString("itemid")); } OldUrlEdit.Value = HttpUtility.UrlDecode(WebUtil.GetQueryString("oldpath")); QueryStringEdit.Value = HttpUtility.UrlDecode(WebUtil.GetQueryString("querystring")); string selectedSite = HttpUtility.UrlDecode(WebUtil.GetQueryString("site")); if (string.IsNullOrEmpty(selectedSite)) { selectedSite = "website"; } foreach (var site in SiteManager.GetSites()) { ListItem li = new ListItem() { Header = site.Name, Value = site.Name }; if (site.Name.ToLower() == selectedSite) { li.Selected = true; } SiteCombobox.Controls.Add(li); } } }