Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Code Behind in SharePoint

  Asked By: Antwan    Date: Oct 29    Category: Sharepoint    Views: 949

Is there a way to allow code behind in aspx pages deployed in
SharePoint? And does it work for both 12 hive file system pages as
well as customized pages that reside in the content databases?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Eliza Hutchinson     Answered On: Oct 29

Not directly, but some minor changes make it possible for both uncustomized and
customized pages. Take the current code  behind page and add it to a class
library project. Remove the 'partial' from the class definition to turn it into
a fully compiled class. Then set the aspx  page to inherit directly from this
class and remove the code behind entry from the @Page directive. Depending on
your code you may have to do some other tweaks, but that's about all it takes.

I've done this on a couple projects to convert existing pages. If you are
writing new code I would recommend putting it into a web part instead of a page
with a code behind. That's more in keeping with the expected development model
for SharePoint.

 
Answer #2    Answered By: Lesley Tate     Answered On: Oct 29

I usually develop web parts anyway. Thanks.

 
Didn't find what you were looking for? Find more on Code Behind in SharePoint Or get search suggestion and latest updates.




Tagged: