Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Can Page Layouts be created in Visual Studio?

  Asked By: Pallavi    Date: May 15    Category: Sharepoint    Views: 2267

If so, how would this be done and if it can't be done then how do you
add logic or server side code to page layouts?



8 Answers Found

Answer #1    Answered By: Trinity Scott     Answered On: May 15

You speak of Site Definitions and Master Pages. I'd point you in the
direction of Mr. Todd Bleeker and his wssv3 book.

Or if you're curious, you can go and tinker in the sandbox of life at:

%DRIVE%\Program Files\common files\microsoft shared\web server

Answer #2    Answered By: Constance Guerrero     Answered On: May 15

No, nothing to do with master pages and site definitions, I know all
about them. I am looking to create page  layouts (has to do with
content management). You can create page layout templates that users
can edit and publish......but I want to know if you can add code
behind to the page layout templates (like you could with CMS 2002).

Answer #3    Answered By: Caleb Gordon     Answered On: May 15

I stand corrected good sir. My apologies for misreading.

Hopefully another gent is able to assist.

Answer #4    Answered By: Irving Hurley     Answered On: May 15

This information was sent to me by a MS consultant when I was asking
something similar, but not identical to what you are asking. It may
work just as well for layouts  as they are .aspx. I can't take credit,
or responsibility, for the content since it was sent to me
without an author, sorry.

Answer #5    Answered By: Tiana Whitaker     Answered On: May 15

No worries.........I have done the same thing on a few occasions

Answer #6    Answered By: Alice Chandler     Answered On: May 15

Another way (other than my other post) would be to create your logic
in a user control, add your .ascx and code  behind to the
/_controltemplates/ VDIR, then insert your register tag in your .aspx
page. We've done this a few times for some custom code we needed to
put into the layout.

Like so...

In the head...
<%@ Register TagPrefix="userControls" TagName="ctrlSearch"
src="~/_controlTemplates/ctrlSearch.ascx" %>

Where you want your control...
<userControls:ctrlSearch runat="server"/>

You could always compile to .dll and put that in the GAC too, but
that's a little bit more complicated. The above is process is IMHO

LMK if you have questions,

Answer #7    Answered By: Lynette Sawyer     Answered On: May 15

I really can't beleive MS would take out
the ability to write "real" ASP.NET pages as page  Layout Templates
since CMS 2002 had this ability and is now gone.

The other really strange thing is you can add ASP.NET controls to
Page Layout Tempates in SharePoint Designer but you have no way to
put logic  or "code behind" on those controls....so what would be the
point? I would imagine a lot of CMS developers will not be happy
with using MOSS as a replacement for CMS.

Answer #8    Answered By: Joanne Greer     Answered On: May 15

Remember that in ASP.NET 2.0 code  can be added directly inline to the
page in a script tag. Because of changes in the object model this is
not just VBscript anymore. You can put regular code directly on a .aspx
page. It will then be compiled into the page. You don't need to use
Code Beside files anymore. (I know we used ot call them Code Behind
files, but the name was actually changed in ASP.NET 2.0). You should be
able to open the .ASPX file directly into VS and add code via a <SCRIPT>

Didn't find what you were looking for? Find more on Can Page Layouts be created in Visual Studio? Or get search suggestion and latest updates.