本文整理汇总了C#中System.Web.Mvc.FormCollection.HasKey方法的典型用法代码示例。如果您正苦于以下问题:C# FormCollection.HasKey方法的具体用法?C# FormCollection.HasKey怎么用?C# FormCollection.HasKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Mvc.FormCollection
的用法示例。
在下文中一共展示了FormCollection.HasKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEditorUrl
/// <summary>
/// Return the editor URL for the currrent node depending on the data found in the query strings
/// </summary>
/// <param name="id"></param>
/// <param name="queryStrings"></param>
/// <returns></returns>
/// <remarks>
/// This checks if the tree there is a OnNodeClick handler assigned, if so, it assigns it,
/// otherwise it checks if the tree is in DialogMode, if it is then it returns an empty handler, otherwise
/// it sets the Url to the editor's url.
/// </remarks>
public string GetEditorUrl(HiveId id, FormCollection queryStrings)
{
Mandate.ParameterNotEmpty(id, "id");
Mandate.ParameterNotNull(queryStrings, "queryStrings");
Mandate.That<NullReferenceException>(Url != null);
var isDialog = queryStrings.GetValue<bool>(TreeQueryStringParameters.DialogMode);
return queryStrings.HasKey(TreeQueryStringParameters.OnNodeClick) //has a node click handler?
? queryStrings.Get(TreeQueryStringParameters.OnNodeClick) //return node click handler
: isDialog //is in dialog mode without a click handler ?
? "#" //return empty string, otherwise, return an editor URL:
: Url.GetEditorUrl(
id,
EditorControllerId,
BackOfficeRequestContext.RegisteredComponents,
BackOfficeRequestContext.Application.Settings);
}
示例2: CreateRootNode
/// <summary>
/// Helper method to create a root model for a tree
/// </summary>
/// <returns></returns>
protected virtual TreeNode CreateRootNode(FormCollection queryStrings)
{
var jsonUrl = Url.GetTreeUrl(GetType(), RootNodeId, queryStrings);
var isDialog = queryStrings.GetValue<bool>(TreeQueryStringParameters.DialogMode);
var node = new TreeNode(RootNodeId, BackOfficeRequestContext.RegisteredComponents.MenuItems, jsonUrl)
{
HasChildren = true,
EditorUrl = queryStrings.HasKey(TreeQueryStringParameters.OnNodeClick) //has a node click handler?
? queryStrings.Get(TreeQueryStringParameters.OnNodeClick) //return node click handler
: isDialog //is in dialog mode without a click handler ?
? "#" //return empty string, otherwise, return an editor URL:
: Url.GetCurrentDashboardUrl(),
Title = NodeDisplayName
};
//add the tree id to the root
node.AdditionalData.Add("treeId", TreeId.ToString("N"));
//add the tree-root css class
node.Style.AddCustom("tree-root");
//node.AdditionalData.Add("id", node.HiveId.ToString());
//node.AdditionalData.Add("title", node.Title);
AddQueryStringsToAdditionalData(node, queryStrings);
//check if the tree is searchable and add that to the meta data as well
if (this is ISearchableTree)
{
node.AdditionalData.Add("searchable", "true");
}
return node;
}
示例3: GetEditorUrl
/// <summary>
/// Return the editor URL for the currrent node depending on the data found in the query strings
/// </summary>
/// <param name="id"></param>
/// <param name="queryStrings"></param>
/// <returns></returns>
protected virtual string GetEditorUrl(HiveId id, FormCollection queryStrings)
{
var isDialog = queryStrings.GetValue<bool>(TreeQueryStringParameters.DialogMode);
return queryStrings.HasKey(TreeQueryStringParameters.OnNodeClick) //has a node click handler?
? queryStrings.Get(TreeQueryStringParameters.OnNodeClick) //return node click handler
: isDialog //is in dialog mode without a click handler ?
? string.Empty //return empty string, otherwise, return an editor URL:
: Url.GetEditorUrl(id, EditorControllerId, BackOfficeRequestContext.RegisteredComponents, BackOfficeRequestContext.Application.Settings);
}