title: Add Summary Toolbar programmatically to a ListViewWebPart in SharePoint 2010
body: <p>I have a Listview Web Part on my homepage showing some announcements from an announcement list. Instead of going to the list in All site content each time to add a new announcement, I want to do it directly from the Web Part on my homepage. I changed the Web Part directly from the browser and saw that it is called "Summary Toolbar". So the question is, how do I get the same result programmatically?</p>
  
  <p>My code for the Web Part:</p>
  
  <pre><code>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();
  </code></pre>
  
  <p>Thanks in advance!</p>