简体   繁体   English

将WebPart添加到“应用程序”页面

[英]Add a WebPart to an Application page

I have a "Data view web part" created from SharePoint Designer. 我有一个从SharePoint Designer创建的“数据视图Web部件”。 I added the web part to my visual studio project as a "Web Part" . 我将Web部件作为“ Web部件”添加到了Visual Studio项目中。 I want to know how to add the web part to an application page. 我想知道如何将Web部件添加到应用程序页面。

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. 嗨,我知道这很晚,但是今天我必须做同样的事情,所以我在sharepoint.stackexchange.com上遵循了一个很好的答案。 But basically is like adding any other asp.net control on an APS.NET page. 但基本上就像在APS.NET页上添加任何其他asp.net控件一样。

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). 然后使用asp.net所需的属性(ID和Runat)将Web部件添加到页面(在主占位符上)。

<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. 唯一的事情是您将无法通过浏览器编辑页面和修改Web部件,如果您需要修改Web部件的任何其他属性,则必须使用html或后面的代码来完成。

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 这是我关注的链接的网址: https : //sharepoint.stackexchange.com/questions/26508/is-it-possible-to-add-web-parts-to-an-application-page页面

i hope it helps. 我希望这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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