Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a user control which takes in a content picker parameter and then renders the children of the content picker value.
When I insert the macro onto a template and select a page via the content picker, the correct value is displayed.
But for some reason when I view the site, the user control value is always the root value (1050).
If I hardcode the source value in the user control, then it renders the children correctly.
I have supplied the template and user control below.
Any ideas why this might be happening?
<%@ Master Language="C#" MasterPageFile="~/masterpages/Master.master" AutoEventWireup="true" %><asp:Content ContentPlaceHolderID="masterContent" runat="server"> <div id="mainContent" class="fc"> <div class="navigation"> <umbraco:Macro ID="Macro2" CssClassName="" CssId="" StopLevel="6" StartLevel="2" Alias="Navigation" runat="server"></umbraco:Macro> </div> <div id="content"> <umbraco:Item ID="Item2" Field="bodyText" runat="server" ></umbraco:Item> <asp:ContentPlaceHolder Id="contentContent" runat="server"></asp:ContentPlaceHolder> <umbraco:Macro source="1051" Alias="TestUC" runat="server"></umbraco:Macro> </div> <umbraco:Macro Alias="SidePanels" runat="server"></umbraco:Macro> </div> </asp:Content>
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using umbraco.NodeFactory;namespace TestUC{ public partial class UC01 : System.Web.UI.UserControl { public int source { get; set; } protected void Page_Load(object sender, EventArgs e) { if (source > 0) { ltSource.Text = source.ToString(); var node = new Node(source); var currentNode = Node.GetCurrent(); rptNodes.DataSource = node.Children; rptNodes.DataBind(); } } }}
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
User control content picker
I have a user control which takes in a content picker parameter and then renders the children of the content picker value.
When I insert the macro onto a template and select a page via the content picker, the correct value is displayed.
But for some reason when I view the site, the user control value is always the root value (1050).
If I hardcode the source value in the user control, then it renders the children correctly.
I have supplied the template and user control below.
Any ideas why this might be happening?
is working on a reply...