Thursday, April 24, 2014

Re-using SharePoint controls


Ref:

http://community.zevenseas.com/Blogs/Robin/Lists/Posts/Post.aspx?ID=96


1.SPDatePickerControl:
2.ButtonSection
3.InputFormRequiredFieldValidator
4.InputFormRangeValidator
ToolBar & ToolBarButton


Button:

<%@ Register TagPrefix="wssuc" TagName="ButtonSection" 
src="~/_controltemplates/ButtonSection.ascx" %>
<wssuc:ButtonSection runat="server">
    <Template_Buttons>
        <asp:Button runat="server" class="ms-ButtonHeightWidth" 
        OnClick="OnClickOK" Text="<%$Resources:wss,multipages_okbutton_text%>" 
        id="btnOk" accesskey="<%$Resources:wss,okbutton_accesskey%>"/>
    </Template_Buttons>
</wssuc:ButtonSection> 
When making use of the LayoutsPageBase in your codebehind, you can define the URL of the Cancel button by using this snippet:
public override string PageToRedirectOnCancel
{
    get
    {
        //return base.PageToRedirectOnCancel;
        return "/_layouts/settings.aspx";
    }
}


DatePiker Control
<script type="text/javascript" 
src="/_layouts/datepicker.js"></script>
<SharePoint:SPDatePickerControl id="datePickerControl" 
   runat="server"/>

Thursday, March 27, 2014

SharePoint Global Navigation

SharePoint Global Navigation 

add it before </head>

<SharePoint:CssRegistration name="<% $SPURL:~sitecollection/Style Library/raviStyle.css %>" After="corev4.css" runat="server"/>

---------------------------------------------------------------------------------------------------------


.s4-lp, body #s4-topheader2{
background-color:#4fb3d3;
margin-left:0px;
border-top:0px;
border-bottom:0px;
margin-left:0px;
}
.menu-horizontal{
margin-left:10px;
border-right: 1px #81C8DF solid;
background-image:none;
}
.menu-horizontal ul li{
color:#fff!important;
min-height:31px;
line-height:30px;
border:0px;
padding:0px;
margin:0px;
border-left:1px #81C8DF solid;
}
.menu-horizontal ul li a{
color:#fff!important;
font-weight:bold;
border:0px!important;
padding:0px!important;
margin:0px;
height:31px!important;
background-color:#4fb3d3; 
padding-right:18px!important;
padding-left:18px!important;
}
.s4-toplinks .s4-tn > .menu-horizontal ul li a:hover {
text-decoration:none!important;
color:#000!important;
height:31px!important;
border:0px;
padding:0px;
margin:0px;
}
.s4-toplinks .s4-tn > .menu-horizontal a.selected {
color: #fff!important;
background-color:#4fb3d3; /*Fallback*/
background: -webkit-gradient(linear, left top, left bottom, from(#036ba8), to(#81C8DF));
background: -moz-linear-gradient(top, #036ba8, #81C8DF);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#036ba8, endColorstr=#81C8DF);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#036ba8, endColorstr=#81C8DF)";
line-height:30px;
height:31px;
border:0px;
padding:0px;
margin:0px;
}
.menu-horizontal A.dynamic-children SPAN.additional-background {
background-image:none!important;
}
.s4-tn ul.dynamic {
background-image:none!important;
border:1px solid #f7f7f7;
border-top:0px;
border-bottom:1px solid #ccc;
margin:0px;
padding:0px;
}
.s4-tn li.dynamic {
background-image:none!important;
border-top:1px solid #ccc;
border-right:1px solid #ccc;
border-bottom:0px solid #ccc;
border-left:1px solid #ccc;
}
.s4-tn li.dynamic > .menu-item {
display:block;
padding-left:19px!important;
white-space:nowrap;
font-weight:normal;
background-color:#ffffff!important;
background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#f7f7f7))!important;
background: -moz-linear-gradient(top, #ffffff, #f7f7f7)!important;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff, endColorstr=#f7f7f7)!important;
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff, endColorstr=#f7f7f7)"!important;
color:#333!important;
}
.s4-tn li.dynamic > a:hover {
background-color:#fff;
background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#ffffff))!important;
background: -moz-linear-gradient(top, #ffffff, #ffffff)!important;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff, endColorstr=#ffffff)!important;
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff, endColorstr=#ffffff)"!important;
}
/*----- Some other stuff -------*/
.col-fluid-1, .right-wp-zone-col {
 margin-top:20px
}
#s4-leftpanel-content {
padding-top:20px!important;
border-right:0px!important;
border-bottom:0px!important;
margin-right:0px;
margin-left:0px;
background-color:#f7f7f7!important
}
.s4-title{
min-height:70px;
padding:0px;
}
.s4-titlelogo{
padding-left:10px
}
TD.ms-sbscopes {
padding-right:0px
}
.s4-search, .s4-rp{
padding-top:3px!important;
margin-right:0px;
}
.s4-search TABLE {
margin-right:0px
}
.s4-title-inner{
background-color:#a0d9e6; /*Fallback*/
background: -webkit-gradient(linear, left top, left bottom, from(#a0d9e6), to(#f7f7f7));
background: -moz-linear-gradient(top, #a0d9e6, #f7f7f7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#a0d9e6, endColorstr=#f7f7f7);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#a0d9e6, endColorstr=#f7f7f7)";
padding:0px 0px 0px 0px;
margin:0px;
min-height:70px;
}

Thursday, December 19, 2013

SharePoint 2010 How to hide the recycle bin and the all site content links

SharePoint 2010 How to hide the recycle bin and the all site content links




1. Edit page
2. Add content editor webpart (CEWebpart)
3. Edit webpart from its dropdown menu
4. Select Editor and select HTML source
5. Past it
--------------------------------------
<style type="text/css">
.s4-recentchanges {
DISPLAY: none
}
.s4-specialNavLinkList {
DISPLAY: none
}</style>
-----------------------------------------------

 n save
6. Select layout 's of CEWebpart and Select Direction as none.
7. click ok.

Wednesday, December 18, 2013

Show current Page location, Breadcrumb global navigation, Show parent sites

                     Show current Page location, 

                    Breadcrumb global navigation,

                                 Show parent sites.


Replace below code in v4.Master:
Before it take its backup and make it Check-Out and modify for safety.
Note: If you its needed, for each site you need to to be repeated.

-----------------------------------------------------------------------------------------
<asp:ContentPlaceHolder id="PlaceHolderSiteName" runat="server">
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/" id="onetidProjectPropertyTitle">
<SharePoint:ProjectProperty Property="Title" runat="server" />
</SharePoint:SPLinkButton>
</asp:ContentPlaceHolder>

-------------------------------------------WITH--------------------------------------------------------

<asp:SiteMapPath
     runat="server"
     SiteMapProviders="SPSiteMapProvider,SPXmlContentMapProvider"
     RenderCurrentNodeAsLink="false"
     NodeStyle-CssClass="breadcrumbNode"
     CurrentNodeStyle-CssClass="breadcrumbCurrentNode"
     RootNodeStyle-CssClass="breadcrumbRootNode"
     HideInteriorRootNodes="true"
     SkipLinkText=""/>

Thursday, December 12, 2013

Create URL in Site actions menu

Create URL in Site actions menu


<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
        Id="MyAction"
        GroupId="SiteActions"
        Location="Microsoft.SharePoint.StandardMenu"
        Sequence="2000"
        Title="RKU App Page"
        Description="Custom page by RKU">
<UrlAction Url="_layouts/TestJAVA/rku.aspx" />
</CustomAction>
</Elements>

Friday, September 6, 2013

Javascript Popup

string script = "<script language='javascript'>alert('Fields are Empty')</script>";
      Page.ClientScript.RegisterClientScriptBlock(GetType(), "Register", script);

Wednesday, July 3, 2013

Get All Sites in a SharePoint form


Get All Sites in a SharePoint form

            SPFarm farm = SPFarm.Local;
            SPWebService service = farm.Services.GetValue<SPWebService>("");
            foreach (SPWebApplication webapp in service.WebApplications)
            {
                foreach (SPSite site in webapp.Sites)
                {                
                    foreach (SPWeb web in site.AllWebs)
                    {
                        Console.WriteLine(web.Url);                       
                    }
                }
            }