Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sean Dooley 273 posts 490 karma points
    Aug 02, 2013 @ 15:56
    Sean Dooley
    0

    Custom section - cannot reference ui controls in code-behind

    I've followed the usual steps for creating a custom section in Umbraco (umbracoApp, umbracoAppTree, user permissions), created a separate project and included the usual references.

    Below is a simple page for the custom section

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="List.aspx.cs" MasterPageFile="../../../masterpages/umbracoPage.Master" Inherits="Patton.Extensions.Organisation.List" %>
    <%@ Register Namespace="umbraco.uicontrols" Assembly="controls" TagPrefix="umb" %>
    <asp:Content ID="Content" ContentPlaceHolderID="body" runat="server">
        <umb:UmbracoPanel runat="server" ID="Panel1" hasMenu="true" Text="List of stores">
            <umb:Pane runat="server">
                <asp:Repeater runat="server" ID="rptOrganisation"></asp:Repeater>
            </umb:Pane>
    </asp:Content>

    In the code-behind, I'm unable to reference the Repeater. Not sure what I've missed - any ideas?

    Umbraco 4.7.2

    .Net Framework 4

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Aug 06, 2013 @ 10:02
    Jeroen Breuer
    0

    Hmm you should be able to find the controls in the code behind. Here is an example I wrote which might help: http://our.umbraco.org/wiki/reference/umbraco-best-practices/standard-ui-controls/umbracouicontrols-page-samples

    Jeroen

  • Sean Dooley 273 posts 490 karma points
    Aug 06, 2013 @ 10:28
    Sean Dooley
    0

    Think my issue is due to how I am inheriting from umbracoPage.Master.

    I changed the MasterPageFile="../../../masterpages/umbracoPage.Master" to MasterPageFile="../masterpages/umbracoPage.Master" and I was able to correctly reference the ui controls in the code-behind.

    I then reverted back to MasterPageFile="../../../masterpages/umbracoPage.Master" due to the file structure I was using and all worked as expected and then has stopped working again.

    Any ideas?

  • Sean Dooley 273 posts 490 karma points
    Aug 06, 2013 @ 11:15
    Sean Dooley
    0

    The issue is still apparent. I can now reference the .NET controls but I am unable to reference the Umbraco controls.

    I created a new page, and I am unable to reference .NET or Umbraco controls. Not sure what I am missing so any help would be much appreciated?

  • Sean Dooley 273 posts 490 karma points
    Aug 06, 2013 @ 11:24
    Sean Dooley
    101

    I came across the answer here http://stackoverflow.com/questions/5405311/cant-access-umbraco-uicontrols

    I needed to add a reference to the ClientDependency.Core.dll which then allowed me to reference .NET and Umbraco controls in the code-behind.

    Hope this helps anyone else who comes across this issue.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies