0

I am trying to design a custom list form wherein the forms shown will depend on the type of user. My intention is to have several web parts to cater for the different types of user. I plan to load only the web part that should be accessed by specific user so that it will be optimal.

I have tried using the SPLimitedWebPartManager class to add the web part in. But each time I load, the web part keeps on adding the same web part over and over again.

Is there a way the only upon loading the webpart will be displayed but not added?

  • 1
    One way would be to use one more webpart, that includes logic to select what webpart to render and then adds that webpart to its own Controls collection – Robert Lindgren Oct 29 '15 at 11:47
  • Hi Robert, what do you mean by adding the webpart to its own Controls collection? Are you referring to the "one more webpart"? Won't the result be the same? I am a little confused, mind explaining more a bit for me? Thanks! – Joe Oct 30 '15 at 1:39
  • The new "one more webpart" would be the only webpart you actually add to the page (manually or with LimitedWebPartManager for example). This webpart would then use some logic to determine what other webpart should be shown for the current user. This other webpart would not be added to the page it self, as a webpart, but only to "the one more webpart's" controls collection at runtime – Robert Lindgren Oct 30 '15 at 5:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.