2

ページタイトルに「siteName」を表示するために使用するテキスト文字列プロパティタイプがあります。

<title><umbraco:Item runat="server" field="siteName" recursive="true" /></title>

「siteName」を追加するには、.net ユーザーコントロールにどのコードが必要ですか?

<asp:Label ID="siteName" runat="server" Text="siteName should go here!"></asp:Label>

誰でも助けることができますか?

これを Umbraco フォーラムに追加したところ、次のように提案されましたが、.ascx ファイルに含める方法がわかりません。

dynamic node = new umbraco.MacroEngines.DynamicNode(umbraco.NodeFactory.Node.GetCurrent()); siteName.Text = node._siteName; 
4

2 に答える 2

1

これをユーザーコントロールで使用できます

//var node = new Node(123); // Get node by Id, good if you have information on a certain page

var node = Node.GetCurrent(); // Get the current node
var nodeProperty = node.GetProperty("siteName").Value;
siteName.Text = nodeProperty;
于 2012-10-07T07:42:55.093 に答える
0

ユーザー コントロールにパブリック プロパティが必要な場合、マクロを介してユーザー コントロールを umbraco に公開すると、そのプロパティもマクロのパラメーターになります。

テンプレートでマクロを参照すると、ページ プロパティを通過できます。

Umbraco TV をチェックしてみてください。

http://umbraco.com/help-and-support/video-tutorials/introduction-to-umbraco/developer-introduction/macro-parameters.aspx

そして古い(しかしほとんど正確な)pdf:

http://umbraco.com/media/42a0202c-b0ba-4f84-bcf1-64dfd5230322-usingcontrolswithumbraco.pdf

于 2012-10-04T23:39:30.300 に答える