Monday, 24 February 2014

SharePoint DataSheet View Branding Issues.

Here are a couple of annoying DataSheet issues I came across today while getting a SharePoint 2007 extranet site ready for one of our clients. 

1) Fix Datasheet View background color

In our custom css file, the body background color is set to:
?
body { background-color: #3a73ba; }

Which makes the Datasheet look horrible:
image
I found a solution for this on Erik Swenson’s blog.  I changed the background color to white (this fixes the Datasheet), and moved the #3a73ba background color to the form tag.  Here’s the new CSS:
?
body { background-color: #fff; }
form#aspnetForm { background-color: #3a73ba; }
Datasheet view with corrected background color:
image

2) Edit in Datasheet causes IE to crash

IE hangs for a very long time; I’ve seen it become responsive again after waiting forever, but most people won’t. If you don’t mind modifying the source files to fix this, go to:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\core.js
And change:
?
var lGCWindowHeight=document.documentElement.scrollHeight;
to:
?
var lGCWindowHeight=(document.documentElement.scrollHeight>document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.documentElement.scrollHeight;

Wednesday, 8 May 2013

Javascript to validate a text filed to add only number

Javascript to validate a text filed to add only number

<asp:TextBox ID="txtboxForDays" runat="server" OnKeyPress="return AllowNumericOnly(this);"></asp:TextBox> 

<script type="text/javascript">
                function AllowNumericOnly(e) {
                    var keycode;
                    if (window.event)
                        keycode = window.event.keyCode;
                    else if (event)
                        keycode = event.keyCode;
                    else if (e)
                        keycode = e.which;
                    else return true;
                    if ((keycode > 47 && keycode <= 57)) { return true; }
                    else { return false; } return true;
                } 
    </script>

Hiding Sharepoint 2010 Ribbon in New Form.aspx with Jquery


Hiding Sharepoint 2010 Ribbon in New Form.aspx with Jquery




//using below script you can hide entire ribbon
//$(“div.’s4-ribboncont:contains(‘Spelling’)”).parent(‘div’)[0].style.display = “none”;
//using below script you can hide ribbon but the dark blue background will remain visible
//$(“div.ms-cui-tabContainer:contains(‘Spelling’)”).parent(‘div’).hide();
//using below script you can hide save Button in Ribbon
//$(“span.ms-cui-ctl-largelabel:contains(‘Save’)”).parent(“a”).hide();
//using below script you can hide past Button in Ribbon
//$(“span.ms-cui-ctl-largelabel:contains(‘Paste’)”).parent(“a”).hide();
//using below script you can hide Cancel Button in Ribbon
//$(“span.ms-cui-ctl-largelabel:contains(‘Cancel’)”).parent(“a”).hide();
//using below script you can hide Attachment Button in Ribbon
//$(“span.ms-cui-ctl-largelabel:contains(‘Attach’)”).parent(“a”).hide();
//using below script you can hide Cut Button in Ribbon
//$(“span.ms-cui-ctl-mediumlabel:contains(‘Cut’)”).parent(“a”).hide();
//using below script you can hide Copy Button in Ribbon
//$(“span.ms-cui-ctl-mediumlabel:contains(‘Copy’)”).parent(“a”).hide();
//using below script you can hide Spelling Button in Ribbon
//$(“span.ms-cui-ctl-largelabel:contains(‘Spelling’)”).parent(“a”).hide();
//using below script you can hide
//$(“span.ms-cui-ctl-a1Internal”).parent(“a”).hide();
//using below script you can hide Menu Label Action in Ribbon
//$(“span.ms-cui-groupTitle:contains(‘Actions’)”).hide();
//using below script you can hide Menu Label Commit in Ribbon
//$(“span.ms-cui-groupTitle:contains(‘Commit’)”).hide();
//using below script you can hide Menu Label Clipboard in Ribbon
//$(“span.ms-cui-groupTitle:contains(‘Clipboard’)”).hide();
//using below script you can hide Menu Label Spelling in Ribbon
//$(“span.ms-cui-groupTitle:contains(‘Spelling’)”).hide();
//using below script you can hide Menu Separator in Ribbon
//$(“span.ms-cui-groupSeparator”).hide();

Friday, 1 February 2013

Hide Upload Document item in Sharepoint Ribbon

It hid the Upload button and am hiding the Add New with the Main web part zone:

Using CSS


<style type="text/css"> 
#Ribbon\.Documents\.New\.AddDocument-Large
{     
 display:none !important; 
} 
</style>
<style type="text/css"> 
td.ms-addnew
{     
 display:none !important; 
} 
</style>

Wednesday, 23 January 2013

Javascript to validate a text filed to add only number

<asp:TextBox ID="txtboxForDays" runat="server" OnKeyPress="return AllowNumericOnly(this);"></asp:TextBox>

<script type="text/javascript">
                function AllowNumericOnly(e) {
                    var keycode;
                    if (window.event)
                        keycode = window.event.keyCode;
                    else if (event)
                        keycode = event.keyCode;
                    else if (e)
                        keycode = e.which;
                    else return true;
                    if ((keycode > 47 && keycode <= 57)) { return true; }
                    else { return false; } return true;
                }
    </script>