Saturday, May 25, 2013

How to hide the quick launch and left panel in SharePoint

While working on a recent assignment for creating a custom master page, the left side quick launch area needed to be hidden. So, I put the below statement in my masterpage's associated  CSS file to override the coreV4.css default behavior:


Saved my css changes in the SharePoint Designer and checked my changes, while it looked fine on the IE 8+, on Mozilla browser, my page content was coming out / exceeding the right boundary as I was making a centered masterpage.

I used Mozilla's Toggle Tools under developer tools menu and found that the left panel was still occupying space on left and making the page content shift to the right. To fix the space occupied by the left panel, I put the below statement in the custom CSS and it did the trick on Mozilla. Do not forget to save the changes to the CSS after you have made the modifications and then refresh the page. 


You can even try 


Wednesday, May 15, 2013

Add Custom CSS to your SharePoint MasterPage

As often it happens, we have to customize the look-n-feel of the v4.master to achieve the styles as expected by customer. At this point, we end up designing a custom CSS and then associate it within the MasterPage. The steps for doing that are explained below:

  • Use an SP2010 control called cssregistration and add a line below the existing csslink:
  • Existing line: runat="server" Version="4" />
  • Now, add the above mentioned control by putting the line: ="server" name="/Style%20Library/Scripts/style.css" After="coreV4.css" />

What this does is basically it tells the SharePoint to load your custom CSS after the load of the default Corev4.css. This way your styles will supersede the default styles.

Saturday, May 11, 2013

Fix the Max Controls Issue in SharePoint

While working with SharePoint MasterPages, sometimes, you might see this peculiar issue, "This page allows a limit of 200 controls, and that limit has been exceeded" and ponder over what could have caused it.

The real source for this exception to be thrown is in the web.config file,

="200" CallStack="true" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false" />

So, this is about the limit that Microsoft has typically placed in a SharePoint Web Application's web.config, the SafeMode section has a MaxControls attribute that's set to 200 by default.

Going past this threshold limit may cause stability issues for the page. This could have been caused accidentally while you were adding some custom controls on the Masterpage.

To fix this, do not try to edit the web.config Max Controls setting to a higher number as that is not recommended although for smaller enterprises it might be permissible. However, at large corporations, this would not be allowed by their IT department.

Rather, you should take out a few controls from the MasterPage by editing it in the SharePoint Designer (SPD) and do an IISReset, your page starts working again. This should save your day again.. :)

Friday, May 10, 2013

Steps to consume Aspose Cells license in Code

Recently, I got the chance to use Aspose.Cells in one of my project. Once, you have procured the Product license key which is typically in a .txt file, you can register the license in 4 simple steps:

  1. Get rid of any reference to the evaluation period version of the DLL (if used) from your solution
  2. Add a folder in the VS2010 Solution and just add a folder and place the required license file (Aspose.Cells.Lic)
  3. Make the client license as a part of the VS2010 solution by going to the license property in Visual Studio and choosing In the Properties dialog box, locate the Build Action property. By default, this property is set to Content. Click the property and change the Build Action property to Embedded Resource
  4. Before starting the use of the available tool in the visual studio webpart, you need to write the below code atleast once in the code and refer to the correct DLL. 
  5. This method can be called on the Page_Load of the Visual Webpart code behind (.cs) file. For more details, use the below mentioned URL to the Aspose team: 
  7. //Instantiate the License class
    Aspose.Cells.License license = new Aspose.Cells.License();
    //Pass only the name of the license file embedded in the assembly


Related Posts with Thumbnails