Add a WebPart to an Application page

喜你入骨 提交于 2019-12-24 03:43:35

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/14859768/add-a-webpart-to-an-application-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!