Posts

Showing posts from 2013

Server Error in '/' Application. SharePoint 2010

Below changes should be made in web.config (C:\inetpub\wwwroot\wss\VirtualDirectories\<Port>) 1.In customErrors tag set mode =" Off " to "On " 2.In SafeMode tag set CallStack =" true " to " false" 3.In compilation tag debug="false" to "true" Done!

Create and deploy HTTPModule in SharePoint 2010

1. Create a class library 2. Add below code in the cs file using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; using System.Web.UI; using Microsoft.SharePoint; using System.Configuration; using Microsoft.SharePoint.ApplicationRuntime; namespace DynamicModule {     public class DynamicModule : IHttpModule     {         public void Init(HttpApplication context)         {             context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute);         }         void context_PreRequestHandlerExecute(object sender, EventArgs e)         {             Page page = HttpContext.Current.CurrentHandler as Pa...

SharePoint search with jQuery

The data in Sharepoint can be searched using Search.asmx web service. This code just needs a CEWP to search the data using jQuery. Add a Content Editor Web Part to your page. Add the below code to your Content Editor Web Part Enter any keyword to search the data Please make sure that the data in SharePoint is crawled to search the content. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> // *** Customizable parameters *** var quickSearchConfig = { delay: 500, // time to wait before executing the query (in ms) minCharacters: 3, // minimum nr of characters to enter before search scope: "All Sites", // search scope to use numberOfResults: 75, // number of results to show resultsAnimation: 200, // animation time (in ms) of the search results resultAnimation: 0 // animation time (in ms) of individual result (when selected) }; </s...

Enabling anonymous access on SharePoint 2010

Enable anonymous access for the Web application. To do this follow these steps: Start SharePoint 3.0 Central Administration, and then click Application Management . Under Application Security , click Authentication providers . In the Web Application box, click the arrow, click Change Web Application , and then click the Web application that you want. Under the Zone heading, click Default to open the Edit Authentication page. On the Edit Authentication page, click to select the Enable anonymous access check box, and then click Save . Enable anonymous access for the site collection. To do this, follow these steps: Open the site collection that is hosted in the Web application in the browser. Click Site Actions , and then click Site Settings . Under Users and Permissions , click Advanced permissions . Click Settings , and then click Anonymous Access . Click Lists and libraries , and then click OK . Enable anonymous access for the resource. To do this, follo...

WebPart Life Cycle

OnInit: This event handles initialization of the control. OnLoad: This event handles the Load event. This is also used for initialize the control but is not intended for loading data or other processing functionality. CreateChildControls: This event creates any child controls. So if you are adding any control to display then you have to write in this method. EnsureChildControls: This method ensures that CreateChildControls has executed. This method must be called to prevent null reference exceptions. SaveViewState: View state of the web part saved. OnPreRender: This method handles or initiates tasks such as data loading that must complete before the control can render.  Page.PreRenderComplete: The page fires the PreRenderComplete event after all controls have completed their OnPreRender methods. Render: This method is used to render everything. RenderContents: Renders the contents of the control only, inside o...