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>