1

I have a user control that i have registered in the web.config and i'm using in another user control.

the structure looks like this

  • Base layout
    • home sublayout
      • feature user control 1
      • feature user control 2

when i use the user control as a user control

<ns:feature id="x" runat="server" visible = true/>

the code behind gets hit, but the mark up is never embedded on the page.

if i use it as a sublayout however

<sc:Sublayout ID="x" runat="server" path="/sublayouts/feature.ascx"/>

this renders perfectly fine and i get all the markup.

am i missing some configuration setting? I could use them all as sublayouts, but i'm just curious why it is not working. This is the first time i'm setting up sitecore myself, previously i'v always worked on existing projects.

*update I registered the user control directly on the home sublayout's ascx file and that fixed it. Just realized any user control i use that has been registered in the web.config pointing to the project's own assembly isint working.

munsense
  • 49
  • 4
  • Which version of sitecore you use? What is the code behind of the user control? – Marek Musielak Aug 01 '12 at 08:08
  • Move that UC file to another folder and try again. Just a thought – Mark Ursino Aug 01 '12 at 10:20
  • @MarkUrsino yeah that was the first thing i did when i realized the two user controls were sitting beside each other. but it was still causing the problem. – munsense Aug 01 '12 at 10:49
  • i'm using 6.4 at the moment the user control has no code behind at the moment apart from the page load, but eventually it will be a user control which sets a datasource and binds a repeater. – munsense Aug 01 '12 at 10:51
  • oh man i cant even construct proper sentences anymore. @Maras i'm using sitecore 6.4. There was no code behind on the page apart from the default page load method. There was some dummy mark up on it which was only rendering when used as a sublayout. – munsense Aug 01 '12 at 11:20
  • I misunderstood your questions. Based on what you said the fix was, I know I did. I thought you were saying that when using the user control via a raw link to the ascx file wouldn't get the content.. which WILL happen if you put a straight link, don't databind some source data and the user control isn't actually in the presentation details for the item. – divamatrix Jul 23 '13 at 21:57
  • It's not an answer to your problem but I would go with using the sc:Sublayout approach as it wraps your control giving it useful capabilities such as HTML output caching. – Kevin Obee Dec 30 '13 at 20:25

0 Answers0