本文整理汇总了C#中UrlString.Substring方法的典型用法代码示例。如果您正苦于以下问题:C# UrlString.Substring方法的具体用法?C# UrlString.Substring怎么用?C# UrlString.Substring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UrlString
的用法示例。
在下文中一共展示了UrlString.Substring方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddItem
protected void AddItem(ClientPipelineArgs args) {
if (args.IsPostBack) {
if (args.HasResult) {
SetModified();
LastSelectedItemID = args.Result;
SheerResponse.Eval("window.frames['{0}_frame'].window.scVisualList.addItem('{1}');".FormatWith(ID, args.Result));
}
}
else {
var source = new UrlString(StringUtil.GetString(Source, "/sitecore/media library")).Path;
Item lastSelectedItem = null;
if (!string.IsNullOrEmpty(LastSelectedItemID)) {
lastSelectedItem = Client.ContentDatabase.GetItem(LastSelectedItemID);
}
if (source.Contains("/sitecore/media library")) {
var options = new MediaBrowserOptions();
if (source.StartsWith("~")) {
options.Root = Client.GetItemNotNull(ItemIDs.MediaLibraryRoot);
options.SelectedItem = Client.GetItemNotNull(source.Substring(1));
}
else {
options.Root = Client.GetItemNotNull(source);
}
if (lastSelectedItem != null && lastSelectedItem.Parent.Paths.IsDescendantOf(options.Root)) {
options.SelectedItem = lastSelectedItem.Parent;
}
SheerResponse.ShowModalDialog(options.ToUrlString().ToString(), true);
}
else {
var options = new SelectItemOptions { Title = "Please Select an Item", Text = "Select an item to add", Icon = "Applications/32x32/star_green.png" };
if (source.StartsWith("~")) {
options.Root = Client.GetItemNotNull(ItemIDs.ContentRoot);
options.SelectedItem = Client.GetItemNotNull(source.Substring(1));
}
else {
options.Root = Client.GetItemNotNull(source);
}
if (lastSelectedItem != null && lastSelectedItem.Paths.IsDescendantOf(options.Root)) {
options.SelectedItem = lastSelectedItem;
}
SheerResponse.ShowModalDialog(options.ToUrlString().ToString(), true);
}
args.WaitForPostBack();
}
}