Programmatically added SummaryLinkWebPart doesn't display Links
Posted
by Mac
on Stack Overflow
See other posts from Stack Overflow
or by Mac
Published on 2010-05-05T16:32:00Z
Indexed on
2010/05/14
15:44 UTC
Read the original article
Hit count: 316
sharepoint2007
Hi All,
I am using below code to Add SummaryLinkWebPart to a Page and also adding few links to that wehbpart. I can see the webpart now on the page but it doesn't have any links inside it. Does anyone know what is wrong with the code?
SPLimitedWebPartManager wpm = web.GetLimitedWebPartManager("Pages/default.aspx",PersonalizationScope.Shared);
SummaryLinkWebPart slwp = new SummaryLinkWebPart(); for (int counter = 0; counter < list.ItemCount; counter++) { urlField = list.Items[counter]["URL"].ToString().Split(',');
SummaryLink link = new SummaryLink(urlField[1].Trim());
slwp.SummaryLinkValue.SummaryLinks.Add(link);
slwp.SummaryLinkValue.SummaryLinks[counter].OpenInNewWindow = true;
slwp.SummaryLinkValue.SummaryLinks[counter].LinkUrl = urlField[0].Trim();
slwp.SummaryLinkValue.SummaryLinks[counter].Description = urlField[1];
slwp.Style = "Image on left";
Console.WriteLine(link.LinkUrl + link.Title);
}
wpm.AddWebPart(slwp, lvwp.ZoneID, slwp.ZoneIndex + 1);
© Stack Overflow or respective owner