2

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?

1

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

| improve this answer | |
1

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...

| improve this answer | |

Your Answer

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

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