Some of us face this issue while casting webparts in the page. Your code is like this when you get this error.
foreach (Microsoft.SharePoint.WebPartPages.WebPart item in wpManager.WebParts)
{
if (item.Title.Equals(webpartTitle))
{
isExists = true;
}
}
Make like this
foreach (System.Web.UI.WebControls.WebParts.WebPart item in wpManager.WebParts)
{
if (item.Title.Equals(webpartTitle))
{
isExists = true;
}
}
foreach (Microsoft.SharePoint.WebPartPages.WebPart item in wpManager.WebParts)
{
if (item.Title.Equals(webpartTitle))
{
isExists = true;
}
}
Make like this
foreach (System.Web.UI.WebControls.WebParts.WebPart item in wpManager.WebParts)
{
if (item.Title.Equals(webpartTitle))
{
isExists = true;
}
}
I really enjoyed reading this post, big fan. Keep up the good work andplease tell me when can you publish more articles or where can I read more on the subject? SharePoint Intranet
ReplyDelete