Tuesday, October 22, 2013

TaxonomyWebTaggingControl is not rendering properly (WebTaggingUI.css not added)

Recently, I faced a small issue with rendering the TaxonomyWebTaggingControl. It works but the display was really weird. I figured that it would be a css not being added properly to the page. I found the respective css file to be added to the page (WebTaggingUI.css). But I was not sure what control needs to be added to include that css file to the page.

After a little bit of research and playing with my master page and page layouts, I found that the CssLink control is responsible for including required css files to the pages. I have added a new CssLink  (Microsoft.SharePoint.WebControls.CssLink) (shown below) control to the master page and everything magically looks to work fine.

CssLink control added to master page:
    <SharePoint:CssLink ID="CssLink1" runat="server" Version="4" />

TaxonomyWebTaggingControl before the css link added: 


After adding css link control:

Happy Coding.
Senthil S

Wednesday, August 28, 2013

Not able to add web parts to any page - page does nothing when clicking "Add Web Parts" is clicked

I faced a weird issue where I was not able to add any web parts to any page in the site. What weird is that Chrome works fine. It happens only in IE (all versions) and FireFox. On inspecting the bug I got an error when the page tries to get the web parts data back from the server asynchronously (you can view it in the console window/network traffic)

The error looked in FF console window some thing like this:

And the detailed Exception message was some thing like this:

[FormatException: Invalid character in a Base-64 string.]
   System.Convert.FromBase64String(String s) +0
   System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +98
   System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, 
String serializedState) +59
   System.Web.UI.HiddenFieldPageStatePersister.Load() +124

[ViewStateException: Invalid viewstate. 
...
...
[HttpException (0x80004005): The state information is invalid for this 
page 
and might be corrupted.]
   System.Web.UI.ViewStateException.ThrowError(Exception inner, String 
persistedState, String errorPageMessage, Boolean macValidationError) +148
   System.Web.UI.HiddenFieldPageStatePersister.Load() +10989814
   System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +11074728
   System.Web.UI.Page.LoadAllState() +46
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsy
ncPoint, Boolean includeStagesAfterAsyncPoint) +11070247
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPo
int, Boolean includeStagesAfterAsyncPoint) +11069786
   System.Web.UI.Page.ProcessRequest() +91
   System.Web.UI.Page.ProcessRequest(HttpContext context) +240
   ASP.LEFTRIGHTWIDEPAGELAYOUT_ASPX__745581150.ProcessRequest(HttpContext 
context) +9
   Microsoft.SharePoint.Publishing.TemplateRedirectionPage.ProcessRequest
(HttpContext context) +175

   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecu
tionStep.Execute() +599
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean
& completedSynchronously)


Did some research for almost a day and it turned out to be an issue that I introduced when fixing an issue with Chrome browser which did not load the SP.js file for all the clients. I inserted the below java script in all the page layouts which triggered twice in IE and FF which caused the issue.

The java script which introduced the bug is

if (typeof (_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();

the js function _spBodyOnLoadWrapper() got called twice and made the web parts panel to stop working.

I got this above javascript to fix some bugs in Chrome browser from the below site

http://developer.mintrus.com/2012/08/sharepoint-2010-improving-chrome-support/

But I made a mistake of just copying the the code to call just the function regardless of what browser it is. It made my day worse.

Be cautious to not to mess with all the JavaScript function of SharePoint. If you do make sure twice you are doing the right thing. Track any java script errors occur in any page before moving forward.

This I learnt the hard way. I still enjoy coding.

Happy Coding.
Senthil S

Tuesday, August 20, 2013

Site Navigation does not show the subsites

Yes. It happened to us where one WFE shows all the sub sites in the "Navigation" options under "Navigation Editing and Sorting" whereas another WFE was showing all the sub sites correctly. Dues to this the navigation menu is different between the servers.

On researching on this issue we did not hit any pages at all but one. We tried what is told in that post as well. Tried to reset the Global Navigation to same as Parent Site and came back to the page to find out nothing shows up still.


Since we did a recent migration to a new server we thought some clock might have got out of sync in one of our servers and it affected the navigation system and decided to re-deploy the package again.

Re-deploying the whole package must have cleared up any SP cache built up internally which made it to work. Until now we do not have any idea of what has happened or how it got fixed. We are good for now.

Please follow the steps mentioned in the above link if that does not work just do a re-deploy to the server.

Thanks
Senthil S

Wednesday, August 7, 2013

ExecuteOrDelayUntilScriptLoaded does not work in SharePoint 2010

Hoi everyone.

It has been a very long time since I wrote a post about SharePoint. I was working on another small jQuery, KO project. Since it is nearing completion, I am back on track in SharePoint 2010.

We had a bug where all the script calls using ExecuteOrDelayUntilScriptLoaded doesn't get executed and was throwing exception SCRIPT5009: 'Type' is undefined which I had no idea of. After searching for some time, I came to know that for some reason MicrosoftAjax.js does not get loaded on all pages especially in Chrome browser. I came across this post and it seemed to be working for some time after adding reference to "/_layouts/MicrosoftAjax.js" on the master page. 


Make sure you add MicrosoftAjax.js reference before any instance of ScriptManager gets loaded in the page. Otherwise you will get a different error saying that Sys.WebForms.PageRequestManager is not defined.

There are other solutions as well like the one in the below link. you can give this also a try if it is applicable.

But, unfortunately then I got a different error on some other java script functions. I got the below error

Sys.ArgumentTypeException: Object of type 'Sys._Application' cannot be converted to type 'Sys._Application

Again did a search and found that it can be rectified by setting the ScriptManager's ScriptMode to "Release".

<asp:ScriptManager id="ScriptManager" runat="server" EnablePageMethods="false" ScriptMode="Release" />

Changing all the ScriptManager references in all the pages fixed the whole issue for now at least.

There are other solution that you can also

Hope this helps someone else or may for me itself sometime later.

Happy coding.
Senthil S

Thursday, April 25, 2013

Scrollbars not appearing in IE 7 with SharePoint 2010 sites

Finally, I had an issue with scrolling in SharePoint 2010 site pages and IE version 7 or lower. The Scroll bar appears for all the browsers but these scroll bars does appear in IE browsers version 7 and lower.

After a long research I found a great blog post talking about the same issue I was having. I implemented the changes and magically it started working for me.

http://kyleschaeffer.com/sharepoint/sharepoint-2010-scrolling/ 

Thanks
Senthil S