Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm developing a webpart for SharePoint 2007 and have seen several posts that advise to do all the creation of controls in the code-behind. I'm transitioning from Java J2EE development so I don't have the platform history of .Net/ASP/etc.

In other places it shows how you can do the same thing by embedding the control definition into the asp page with tags

My question is this:

What is the rule governing where to implement controls? Has this rule changed recently, ASP vs ASP.Net or ASP.Net MVC maybe? Is this advice limited to SharePoint development?

share|improve this question
add comment

2 Answers 2

If you are building a Web Part you basically have two options for SharePoint 2007:

  • Build a class that inherits from the WebPart class and build the interface in CreateChildControls (there are other ways also to build the UI, but best practice is to use CCC)
  • Use SmartPart for SharePoint and use a ASP.NET user control

Plain ol ASP and MVC is out of question...

share|improve this answer
add comment

If you're going to be doing any SharePoint web part development, this video is a much watch and it should do a pretty good job answering your question for the SharePoint world (Visual Web Part versus Server Control). The slides are pretty nice to keep around as a quick reminder too.

SharePoint Web Part Development Best Practices

share|improve this answer
    
This link is dead. Do you have another source for this? –  Shane Wealti Mar 25 at 12:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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