Quantcast
Channel: ActiveTopics
Viewing all articles
Browse latest Browse all 72689

Button not Firing when used in UserControl Displayed with Razor

$
0
0

Hi,

I'm fairly new to Umbraco, so just trying a few things out at the moment. Basically we've got a one-to-one multi language website that uses a Razor shorthand "If" to display the appropriate content depending on what langauage is stored in the Session i.e.

<umbraco:Macro ID="Macro4" runat="server" language="cshtml">
     @((Session["lang"].ToString() == "cy") ? @Model.mainContent_cy : @Model.mainContent)

umbraco:Macro>

Within mainContent, I've created a simple macro that uses a usercontrol with a solitary asp.net label and a button. When the button its clicked, the label updates to show the current time.

Using this technique above, the right content with the usercontrol is displayed as expected. However when I click the button, PostBack is not firing, the page just seems to reload.

However, if I explicitly include the mainContent content, everything looks the same but the button DOES fire as expected i.e.

<umbraco:Item ID="Item5" runat="server" field="mainContent" />

Am I overlooking something, or is there a better way rather than the Razor shorthand "If" to display the appropriate content?

Thanks


Viewing all articles
Browse latest Browse all 72689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>