Search This Blog

Monday 6 January 2014

Add to Handler page to SharePoint 2013


http://mauricevanlieshout.wordpress.com/2013/03/18/sharepoint-webpart-call-to-ashx-handler/


Create Custom Ribbon Using SharePoint 2013


http://www.sharepoint-journey.com/custom-actions-in-sharepoint-2013.html


Execution Server Side Methods by Clicking on a DIV


$("#DivID").click(function () {
        __doPostBack('__Page', 'DivID');
    });

on page load add this code

  if (Page.IsPostBack)
            {
                //you will get id of div which called function
                string eventargs =Page.Request["__EVENTARGUMENT"];

                if (!string.IsNullOrEmpty(eventargs))
                {
                    BindDataToGrid();
                }
            }



Get sharepoint site ID using powershall


get-spsite | select Url,ID, RootWeb

Get site back in sharepoint 2013 using Powershall command 


Backup-spsite http://trig161:200" -path "D:\Elavarasu\SiteBack.bak"

Restore site backup in sharepoint site 


Restore-spsite "http://trig161:200" -path "D:\Elavarasu\SiteBack.bak" -force

-force ==over writte site collection

Add Solution to central admin using powershall cmd


add-spsolution "E:\sharepointWSP\petronash.wsp"


Single solution Retract & Remove


Uninstall-SPSolution -Identity <Solution name.wsp>
ex: Uninstall-SPSolution -Identity Solution.wsp
Remove-SPSolution -Identity <Solution name.wsp>
ex: Remove-SPSolution -Identity Solution.wsp

WEBPART PAGE LIFECYCLE


          creating webpart contains various life cycle similar like ASP.net page lifecycle. but based on on your environment it will be differ:

OnInit – Configuration values set using WebBrowsable properties and those in web part task pane are loaded into the web part.

LoadViewState – The view state of the web part is populated over here.

CreateChildControls – All the controls specified are created and added to controls collection. When the page is being rendered for the first time the method generally occurs after the OnLoad() event. In case of postback, it is called before the OnLoad() event. We can make use of EnsureChildControls() – It checks to see if the CreateChildControls method has yet been called, and if it has not, calls it.

OnLoad User Generated Event – for e.g. button click on the web part.

OnPreRender – Here we can change any of the web part properties before the control output is drawn.

RenderContents – Html Output is generated.

SaveViewState - View state of the web part is serialized and saved.

Dispose -UnLoad.

Sunday 5 January 2014

 Sign in as Different User 


C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES\welcome.aspx

<SharePoint:MenuItemTemplate runat="server" ID="ID_LoginAsDifferentUser"
  Text="<%$Resources:wss,personalactions_loginasdifferentuser%>"
  Description="<%$Resources:wss,personalactions_loginasdifferentuserdescription%>"
  MenuGroupId="100"
  Sequence="100"
  UseShortId="true"  />


Export to Excel After Page is Refresh using C#

   //sharepoint postback to work after clicking on export to excel button
<script type="text/javascript" language="javascript">     if (typeof (_spBodyOnLoadFunctionNames) != 'undefined' &&                                           _spBodyOnLoadFunctionNames != null) {        _spBodyOnLoadFunctionNames.push("supressSubmitWraper");    }    function supressSubmitWraper() {
        _spSuppressFormOnSubmitWrapper = true;
    }</script>