简体   繁体   中英

Add a WebPart to an Application page

I have a "Data view web part" created from SharePoint Designer. I added the web part to my visual studio project as a "Web Part" . I want to know how to add the web part to an application page.

Hi i know its kind of late but, today i had to do the same thing, so i followed a great answer on sharepoint.stackexchange.com. But basically is like adding any other asp.net control on an APS.NET page.

First you need to define the prefix for that assembly

<%@ Register tagprefix="prefix" namespace="NameSpaceOfTheWebPart" assembly="FullAssemblyName" %>

ex:

<%@ Register tagprefix="csm" namespace="MySolution.VisualWebPart" assembly="MySolution Version=1.0.0.0, Culture=neutral, PublicKeyToken=335eef5f6f60e56b" %>

and then add the web part to the page (on the main place holder) using the required attributes by asp.net (ID and runat).

<prefix:WebPartClassName ID="ID" runat="server"  />

The only thing is that you won't be able to edit the page and modify the Web Part through the browser, if you need to modify any other property of the Web Part you will have to do it from the html or code behind.

here is the url of the link i followed: https://sharepoint.stackexchange.com/questions/26508/is-it-possible-to-add-web-parts-to-an-application-page

i hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM