本文整理汇总了C#中TreeNode.GetUsedPageTemplateId方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.GetUsedPageTemplateId方法的具体用法?C# TreeNode.GetUsedPageTemplateId怎么用?C# TreeNode.GetUsedPageTemplateId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeNode
的用法示例。
在下文中一共展示了TreeNode.GetUsedPageTemplateId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadData
/// <summary>
/// Loads the initial data from the document
/// </summary>
private void LoadData()
{
node = Node;
if (node == null)
{
return;
}
if (node.IsRoot())
{
// Hide inheritance options for root node
pnlInherits.Visible = false;
}
else
{
inheritElem.Value = Node.NodeInheritPageLevels;
// Try get info whether exist linked document in path
DataSet ds = DocumentManager.Tree.SelectNodes(SiteContext.CurrentSiteName, "/%", node.DocumentCulture, false, null, "NodeLinkedNodeID IS NOT NULL AND (N'" + SqlHelper.EscapeQuotes(Node.NodeAliasPath) + "' LIKE NodeAliasPath + '%')", null, -1, false, 1, "Count(*) AS NumOfDocs");
// If node is not link or none of parent documents is not linked document use document name path
if (!node.IsLink && DataHelper.GetIntValue(ds.Tables[0].Rows[0], "NumOfDocs") == 0)
{
inheritElem.TreePath = TreePathUtils.GetParentPath("/" + Node.DocumentNamePath);
}
else
{
// Otherwise use alias path
inheritElem.TreePath = TreePathUtils.GetParentPath("/" + Node.NodeAliasPath);
}
}
if (node.NodeInheritPageTemplate)
{
// Document inherits template
radInherit.Checked = true;
}
else
{
// Document has its own template
int templateId = node.GetUsedPageTemplateId();
radInherit.Checked = false;
if (node.NodeTemplateForAllCultures)
{
radAllCultures.Checked = true;
}
else
{
radThisCulture.Checked = true;
}
// Set selected template ID
SelectedTemplateID = templateId;
}
ReloadControls();
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
tree = new TreeProvider(CMSContext.CurrentUser);
// Register the dialog script
ScriptHelper.RegisterDialogScript(this);
// Initialize resources
btnInherit.Text = GetString("DefineSiteStructure.InheritFromParent");
reqItemName.ErrorMessage = GetString("DefineSiteStructure.PageNameRequired");
siteName = QueryHelper.GetString("sitename", string.Empty);
nodeId = QueryHelper.GetInteger("nodeid", 0);
// If action not specified, edit mode
action = QueryHelper.GetString("action", "edit");
if (nodeId > 0)
{
}
else
{
TreeNode rootNode = tree.SelectSingleNode(siteName, "/", TreeProvider.ALL_CULTURES);
if (rootNode != null)
{
nodeId = rootNode.NodeID;
AddScript("SetSelectedNodeId(" + nodeId + ")");
action = "edit";
}
}
bool isNewPage = false;
if (!RequestHelper.IsPostBack())
{
switch (action)
{
case "edit":
// Initialize PageTitle
SetTitle("CMSModules/CMS_ImportExport/PageProperties.png", GetString("DefineSiteStructure.PagePropertiesCaption"), null, null);
node = tree.SelectSingleNode(nodeId);
if (node != null)
{
txtPageName.Text = node.DocumentName;
hdnSelected.Value = node.GetUsedPageTemplateId().ToString();
// If root node is selected
if (node.NodeParentID == 0)
{
btnInherit.Text = GetString("DefineSiteStructure.RemoveTemplate");
txtPageTemplate.Text = GetString("Template.SelectorNoTemplate");
txtPageName.Enabled = false;
reqItemName.Enabled = false;
}
else
{
txtPageTemplate.Text = GetString("Template.Inherited");
}
}
break;
default:
// Initialize PageTitle
SetTitle("CMSModules/CMS_ImportExport/PageProperties.png", GetString("DefineSiteStructure.NewPagePropertiesCaption"), null, null);
txtPageName.Text = "";
txtPageTemplate.Text = GetString("Template.Inherited");
isNewPage = true;
break;
}
}
ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "SelectTemplate", ScriptHelper.GetScript(
@"
function OnSelectPageTemplate(templateId) {
document.getElementById('" + hdnSelected.ClientID + @"').value = templateId;
" + ClientScript.GetPostBackEventReference(btnSelect, null) + @"
}
"
));
// Modal dialog
btnSelect.Attributes.Add("onclick", "modalDialog('" + ResolveUrl("~/CMSModules/PortalEngine/UI/Layout/PageTemplateSelector.aspx?isnewpage=" + ValidationHelper.GetString(isNewPage, "") + "&nodeid=" + ValidationHelper.GetString(nodeId, "0")) + "', 'PageTemplateSelection', '90%', '85%');");
}