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
Hi guys,
pleazse advise what is wrong. I used exact code as it shown in Umbraco TV:
==================================================================
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using umbraco.cms.businesslogic.web;using umbraco.BusinessLogic;using umbraco.presentation.nodeFactory;namespace Campus{ public partial class ProgramsControl : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { foreach (Node n in Node.GetCurrent().Children) { parentPage.Items.Add(new ListItem(n.Name, n.Id.ToString())); } } } }}
=================================================================
but VS2010 show follwoing errors right away:
Error 5 The name 'parentPage' does not exist in the current context C:\Temp\campus-com\web\usercontrols\ProgramsControl.ascx.cs 23 21 BOA
================================================================
Page is regular control and I have references to all 3 DLL as shown in video.
Thanks
What does your .ascx look like? I guess you simply have no object called 'parentPage'...
Also: Consider using umbraco.NodeFactory.Node instead of umbraco.presentation.nodeFactory.Node, because the latter is marked as obsolet.
Hey Sandro, thanks for reply.
ASCX looks like that:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ProgramsControl.ascx.cs" Inherits="Campus.ProgramsControl" %><%@ Register Namespace="umbraco.uicontrols" Assembly="controls" TagPrefix="umb" %><p><asp:Literal runat="server" ID="ltr_programslist"></asp:Literal></p>
And I did try to use umbraco.NodeFactory.Node.
Did not do any difference.
Hi All,
Could it be that you're missing a variable declaration? :-) I don't see any variable with the name "parentPage" in your code.
There should be a Dropdownlist control on the .ascx with the name 'parentPage'. You can see it at Minute 2:23 of the video:
Also on Minute 8:27 you can see it in action, where the values get bound to the control.
Thanks,
I found different aproach to problem at hands.
Thanks for reply anyway.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
what is wrong here,code is exactly how it is in video for data binding
Hi guys,
pleazse advise what is wrong. I used exact code as it shown in Umbraco TV:
==================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using umbraco.cms.businesslogic.web;
using umbraco.BusinessLogic;
using umbraco.presentation.nodeFactory;
namespace Campus
{
public partial class ProgramsControl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
foreach (Node n in Node.GetCurrent().Children)
{
parentPage.Items.Add(new ListItem(n.Name, n.Id.ToString()));
}
}
}
}
}
=================================================================
but VS2010 show follwoing errors right away:
=================================================================
Error 5 The name 'parentPage' does not exist in the current context C:\Temp\campus-com\web\usercontrols\ProgramsControl.ascx.cs 23 21 BOA
================================================================
Page is regular control and I have references to all 3 DLL as shown in video.
Thanks
What does your .ascx look like? I guess you simply have no object called 'parentPage'...
Also: Consider using umbraco.NodeFactory.Node instead of umbraco.presentation.nodeFactory.Node, because the latter is marked as obsolet.
Hey Sandro, thanks for reply.
ASCX looks like that:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ProgramsControl.ascx.cs" Inherits="Campus.ProgramsControl" %>
<%@ Register Namespace="umbraco.uicontrols" Assembly="controls" TagPrefix="umb" %>
<p>
<asp:Literal runat="server" ID="ltr_programslist"></asp:Literal>
</p>
And I did try to use umbraco.NodeFactory.Node.
Did not do any difference.
Hi All,
Could it be that you're missing a variable declaration? :-) I don't see any variable with the name "parentPage" in your code.
There should be a Dropdownlist control on the .ascx with the name 'parentPage'. You can see it at Minute 2:23 of the video:
Also on Minute 8:27 you can see it in action, where the values get bound to the control.
Thanks,
I found different aproach to problem at hands.
Thanks for reply anyway.
is working on a reply...