Copied to clipboard

Flag this post as spam?

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


  • Rich Green 2246 posts 4008 karma points
    Dec 15, 2010 @ 23:27
    Rich Green
    0

    Conditionally include user control

    Hey,

    It's been a long day, this is either going to be really straight forward or not possible

    Can I conditionally include a macro that renders a usercontrol in a template?

    Rich 

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Dec 16, 2010 @ 00:17
    Stefan Kip
    1

    You can include the usercontrol's macro and set the 'Visible' attribute in the code-behind based on a condition.

  • Rich Green 2246 posts 4008 karma points
    Dec 16, 2010 @ 00:25
    Rich Green
    0

    Hey,

    Thanks for your reply, this makes sense and is certainly one solution

    Was wondering if there was a way to not call the usercontrol at all?

    Rich

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Dec 16, 2010 @ 00:28
    Stefan Kip
    0

    Well, if it's about performance, maybe you could use 'LoadControl()' and add the usercontrol to a placeholder or a panel at runtime when a condition is true?

  • Rich Green 2246 posts 4008 karma points
    Dec 19, 2010 @ 11:55
  • 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