1

SharePoint 2010: Visual Studio 2010

I have requirement : i have one web part and using custom web part property i load 4 different user control.

Solution 1 : I created web part and using custom web part property I load the different user control.[This deploys successfully and works as expected ]

Solution 2 : Can I use Visual web part for the same ? i tried creating the visual web part and added 3 user control (+ 1 default user control by visual web part).After deploying , 14 hive contained only the default user control not the other 3 user control.

Question : Can i achieve the same using visual web part .If Not , any justification?

1 Answer 1

1

Visual Web part basically does the same as solution 1, as it loads a user control in CreateChildControls (the exception is a Sandboxed visual web part, where the codebehind for the usercontrol inherits from webpart).

Since user controls doesnt show up in CONTROLTEMPLATES: did you remember to set the added user controls as DeploymentType: TemplateFile?

enter image description here

2
  • can u explain your statement "did you remember to set the added user controls as DeploymentType: TemplateFile?" in more detail Commented Jun 16, 2011 at 11:11
  • sure. i added a screenshot of the property in question Commented Jun 16, 2011 at 14:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.