【问题标题】:Add Summary Toolbar programmatically to a ListViewWebPart in SharePoint 2010以编程方式将摘要工具栏添加到 SharePoint 2010 中的 ListViewWebPart
【发布时间】:2013-10-16 12:20:39
【问题描述】:

我的主页上有一个 Listview Web 部件,其中显示了公告列表中的一些公告。我不想每次都去所有网站内容中的列表添加新公告,而是直接从我主页上的 Web 部件中进行。我直接从浏览器更改了 Web 部件,发现它被称为“摘要工具栏”。所以问题是,我如何以编程方式获得相同的结果?

我的 Web 部件代码:

SPLimitedWebPartManager mgr = file.GetLimitedWebPartManager(PersonalizationScope.Shared
ListViewWebPart announcementListWP = new ListViewWebPart();
SPList customLists = web.Lists[StringConstants.ANNOUNCEMENTS];

announcementListWP.ChromeType = PartChromeType.Default;
announcementListWP.Title = "Announcements Web Part";
announcementListWP.ListName = customLists.ID.ToString("B").ToUpper();
announcementListWP.ViewGuid = customLists.Views[StringConstants.DISPLAYVIEW].ID.ToString("B").ToUpper();

customLists.Update();

mgr.AddWebPart(newsListWP, "Right", 1);
mgr.SaveChanges(newsListWP);

web.Update();

提前致谢!

【问题讨论】:

    标签: listview sharepoint toolbar summary


    【解决方案1】:

    您可以使用 xsltlistviewwebpart 代替列表视图并将工具栏设置为完整工具栏/摘要工具栏。 这将为您提供添加新项目链接,您可以在同一页面上添加项目,无需导航即可查看所有站点内容、列表和添加项目

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-28
      • 1970-01-01
      • 2014-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多