Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

31.8.09

How to show/hide webpart programmatically ?

Sometimes, we need to show and hide webparts programmatically based on some events. This can be done by the following code:

SPWeb myWeb = SPContext.Current.Web;
myWeb.AllowUnsafeUpdates = true;

Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager mgr = null;
mgr = myWeb.GetLimitedWebPartManager(
"default.aspx",
System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);
foreach (System.Web.UI.WebControls.WebParts.WebPart myWebPart in mgr.WebParts)
{
// If this is the webpart we want to change...
if (myWebPart.Title == "SomeWebpartName")
{
myWebPart.Hidden = true;
mgr.SaveChanges(myWebPart);
break;
}
}



Global Assembly Cache is Empty !


Problem:
When trying to build and copy to GAC, you see that GAC is empty !!!

Solution:
Restart the "indexing service".

Cannot open Office 2010 documents in sharepoint using Windows 7


Problem:
After installing Office 2010 you discover that it ahs no integration with Sharepoint, and it refuses to open any sharepoint document from it.

Solution:
1- Open Internet Explorer.
2- Go to "Tools".
3- Go to "Internet Options".
4- Click "LAN Settings" ubder "Connections" tab.
5- Check mark for "Use a proxy server for the LAN".
6- Specify 127.0.0.1 as the address.