Posts

Add UserControl in Sharepoint Masterpage

1) create empty sharepoint project. 2) create sharepoint controltemplte mapped folder. 3) In Control templates create usercontrol and deploy the solution. 4) the user control .ascx will deployed at this location. C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES 5) Add this tag in top of sharepoint master page. <%@ Register TagPrefix="CustomNews" TagName="CurrentPageControl" Src="~/_controltemplates/UserControl.ascx" %> 6) use this tag in where you want to display usercontrol data.  <CustomNews:CurrentPageControl ID="myControl" runat="server"/>

Add Web Part inside Master Page in Sharepoint

How you can make a custom web part as part of your master page? Follow the steps given below to add a web part inside a master page. 1. Deploy the web part in your web application as you do normally. 2. Check whether the web part is showing up in the web part gallery. 3. Create a web part page by navigating to the site settings, create web part page. 4. Add your custom web part on the web part page. 5. Start SharePoint designer and open the newly created web part page. 6. You will now find two entries corresponding to the web part you added on the page In the page declaration you will find a entry which looks something like this: "<%@ Register TagPrefix="Wpabc" Namespace="MyNamespace.MyClass" Assembly=" MyNamespace.MyClass, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"%>" Click on the web part section in the page and you will see an entry like this: "<Wpabc:WebPartName runat="ser...

LINQ with joins using sharepoint lists

Image
Here this code is used for using joins in linq uisng sharepoint lists. here is the code.         SPList Firstlist = objWeb . Lists [ "FirstList" ]; SPList Secondlist = objWeb . Lists [ "Secondlist" ]; SPList Thirdlist = objWeb . Lists [ "ThirdList" ]; var customerorders = from SPListItem first in Firstlist . Items join SPListItem second in Secondlist . Items on first [ "Location" ] equals second [ "Location" ] join SPListItem third in Thirdlist . Items on first [ "Location" ] equals third [ "Location" ] select new { Location = Convert . ToString ( first [ "Location" ]), Name = Convert . ToString ( first [ "Name" ]), Address = Convert . ToString ( second [ "Address" ]), Status = Convert . ToString ( third [ "Status" ]) };    

Enable and disable div using radiobutton list

here radiolist is a radiobutton list with two values. <asp:RadioButtonList ID="radiolist" runat="server" onclick="GetRadioButtonListSelectedValue(this);">                                                                                                                         <asp:ListItem Value="witharn" Selected="True"><b>With EUIN & distributor code</b></asp:ListItem...

RadiobuttonList set and get values javascript

For getting values from radiobuttton list <asp:RadioButtonList ID="radiolist" runat="server" onclick="GetRadioButtonListSelectedValue(this);">                                                                                                                         <asp:ListItem Value="witharn" Selected="True"><b>With EUIN & distributor code</b></asp:ListItem>  ...

Browser Back Button Click Event Handling in JavaScript

Normally, the onbeforeunload event is used for handling browser back button functionality as follows: <body onbeforeunload="HandleBackFunctionality()">  function HandleBackFunctionality()  {        if(window.event) //Internet Explorer       {            alert("Browser back button is clicked on Internet Explorer...");        }        else //Other browsers for example Chrome        {            alert("Browser back button is clicked on other browser...");        }  } But there is a problem that identical events can occur once a user clicks on the refresh button of a browser. So, to grasp whether the refresh button or back button is clicked, we will use the subsequent code. if(window.event.clientX < 40 && window.event.clientY < 0)  {       alert("Browser back b...

Sitemappath in sharepoint

We can add sitemap to sharepoint site by using this code. <div style="padding-top: 20px; padding-left: 20px; padding-bottom: 10px;">                                         <a href="../../default.aspx">home</a> <asp:SiteMapPath SiteMapProvider="SPContentMapProvider"       ID="ContentMap" SkipLinkText=""                                             NodeStyle-CssClass="ms-sitemapdirectional" runat="server"/> </div>