I have a dynamig plceholder in a web control (not mvc - don't ask). I'd like to identify the id assigned to that placeholder and the number of items added to it.

Any ideas how to do this that's not a tortuous loop of string functions?

Sitecore 9

  • You need to add some details. Are you in the context of that web control already and the page is a process of rendering? Do you want to count components placed directly in that placeholder only?
    – Marek Musielak
    Commented Jan 15, 2021 at 17:22
  • What implementation of Dynamic Placeholders are you using? Is it the Fortis one or another? AFAIK - none really supported WebForms without some effort.
    – Richard Seal
    Commented Jan 17, 2021 at 4:32
  • @MarekMusielak I'm not certain. But, I definitely can't get to RenderingContext "Do you want to count components placed directly in that placeholder only?" Yes. I can get all the components on the page. And, I can filter those down to the ones in my placeholder if I hard-code the id. It's getting that dynamic id that is causing me the issue Also, I suspect this is not the best way to go about it Commented Jan 17, 2021 at 11:06
  • @RichardSeal I believe it's the ootb Sitecore 9 implementation. Yes, with quite a bit of extending to get them working (was like this when I got here) Commented Jan 17, 2021 at 11:08
  • Maybe - describe what you need this for. What is the reason you want to do this? The OOTB Dynamic placeholders do not support webforms, so its likely that you have something very custom to get that working, so it would be hard to offer a solution
    – Richard Seal
    Commented Jan 17, 2021 at 16:56


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.