Tuesday, July 15, 2014

Custom Masterpage reappears in Modal dialog

Introduction

 We might faced the master page problem which is applied to modal dialog also. I am going to share an idea to resolve this issue.

Solution

When we applying custom master page for our site. The master page will apply to modal dialog also.




To avoid this, we need to add s4-notdlg class in our all custom <div> / <table> in master page .

<div class="footer s4-notdlg">

Deploy your solution and check, this issue will get resolved.




Happy Coding .... !!!!!!




Monday, July 14, 2014

Get value of checked row in Listview Webpart

Introduction

I am going to share my idea about getting value of checked row in ListView webpart. I have achieved this using javascript.

Using javascript

After placed the webpart in sitepages. Just go to your sitepages in visual studio. Then add view button or label in that page to trigger the javascript. 

<input type="button" value="view" onclick="ViewCheckedElement()" />

Add the below script at bottom of sitepage or js file you already have.



function ViewCheckedElement() {
var r = $("tr.s4-itm-selected").attr("iid").split(",")[1];
alert(r);
}

This tr.s4-itm-selected class name will be added when we select the row in listview. We may find id of the row iid attribute.






Deploy the solution in your farm. That's all, an alert will come with checked items when you clicked the view button.

Tuesday, July 8, 2014

Ways to add Visual Webpart in SitePage

Introduction

In SharePoint, We have multiple option to add a webpart in sitepages using programmatically. By,

  •  Using Elements.xml
  •  Referring Webpart Assembly
  • Using SPLimitedWebaprtManager 
Lets see one after one.

Using Element.xml

First Create a SharePoint Empty Project using Visual studio. Then, Add Module with name of SitePages. Add a aspx page in SitePages module. After added a visual webpart in the project. We may get three files.



Follow the below steps to add webpart property in sitepages property:
  • Copy the properties from <webParts> to </webParts> in .webpart file. 
  • Then, Go to Element.xml file of SitePages module. 
  • Create <AllUsersWebPart> between particular page's file tag
  • Paste the <Webparts> within <AllUsersWebPart>.
  • Deploy the project to SharePoint site


Referring Webpart Assembly

We have an option to register the webpart in SitePage and use it as normal control. Steps are,
  • Go to particular sitepage
  • Add Register tag at top of the page. Like this
<%@ Register TagPrefix="TestWB" Namespace="Test.TestWebpart" Assembly="Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=59ae411e05487fd3" %>
  • Use the webpart as normal control in aspx page.
 <TestWB:TestWebPart ID="obj1" runat="server" />. Then, deploy and check in your page.

Using SPLimitedWebaprtManager 

Here, We are going to add a webpart in the page using SPLimitedWebaprtManager. Steps are,

  • Create Event Receiver for Feature
  • Paste the below code on FeatureActivated event
  public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
    SPSite site = properties.Feature.Parent as SPSite;
    using(SPWeb web = site.OpenWeb())
    {
        using(SPLimitedWebPartManager wpManager = web.GetLimitedWebPartManager(page url, System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared))
        {
            YourWebPart webpart = new YourWebPart();
            webpart.ZoneID = "Top";
            webpart.Title = "My Webpart";
            wpManager.AddWebPart(webpart,"Top" , 0);
        }
    }
}

Then, Deploy solution and activate the feature. The webpart will display in the page. Happy Coding... !!!!!



Monday, July 7, 2014

Comment Box in SharePoint 2013

Introduction

Now a days comment is having vital role in all the sites. In SharePoint 2013, We have OOB webpart to have comments. Let we see about that.

Note Board

In SharePoint 2013, We have a NoteBoard webpart to handle the comments. Comments will differ from each page. SharePoint has got the page URL and differentiate the comments among them. Activate the Publishing feature for the site to play with Noteboard.



The Entered comment will be shown below of comment box. NoteBoard will have an option for paging. Paging will work as we have in normal Grid.


Add NoteBoard

Let us see how to add a noteboard in a page. After creation a site page, Click Insert --> Webpart in the ribbon. We will get a pane to choose the webpart. Choose the NoteBoard webpart under Social Collaboration Category.


Then, Click Add. NoteBoard webpart will place in your page. That' all, Page is ready to Comment.

Thursday, June 19, 2014

SharePoint server is slow? might be LDF the cause..

Problem

You may come across the performance issue with SharePoint server. May be the problem of huge size LDF files in SQL server. Let see the solution for the same.

Solution 

We need to Shrink the LDF file in SQL server for better performance. Steps to Shrink,

  • Open SQL Server instance in your machine
  • Right click the database, Select Tasks -> Shrink -> Files in the menu

  • Will get the Shrink form to reduce the file size. Select the Reorganize pages before releasing unused space in Shrink Action part
  • Change Shrink file to 0
  • Then, Click OK 



  • Apply the above steps for the database which contains large amount of size

Wednesday, June 18, 2014

Project Server in SharePoint 2013

Introduction

I am going to share my knowledge about Project Server in SharePoint 2013. Here we have a brief note about Project server


Let we start with How to create a new project.

New Project

After installation of project server, We will land at Project center page. There, we have all the option to create project, Adding team members, Assigning Member to Project and etc. Let us see how to create a new project.

We have two types of projects,
  • Enterprise Project
  • SharePoint Task List
Let we see about Enterprise project. We have an option to create new project in Ribbon. Just click that, there we may find types of projects. Choose Enterprise Project


We will get the Basic Info screen to enter the project information. Project Owner will be current logged in user.


Save the form when filled the form. Then, Project will create soon (It may take sometime to activate all the needed services for enterprise project)

Resources

We need to pick the resource for created project. In Project server, we have an option to add & allocate resource (Build Team). First Let we see about Adding resource. Click the Resource menu in the left navigation. Then, we may find a grid which is having all the sync resources with project server.

Adding Resources



We have New resource option in Resource tab at ribbon


We will get the new resource form when we clicked the New button. There we need to fill up all the needed fields for the resource. Then click Save to sync the resource with Project Server.

Build Team

In Project details page, We may find the Build Team button at Project tab in ribbon.


We will get a new form with all synchronized resources in grid. We may find two pane there. All  synchronized resources are displaying in left pane. Move resource to right pane for assign them into the project.

Click Save button in ribbon after the allocation done.


Creating Task

We may find the Task summary grid while clicking the project in project center landing page.



This summary grid is editable to the project owner. He/She may enter the task while click Task Name column in Empty Row. If you want to edit an existing task, double click the Task Name. Click Publish button at Task pane in ribbon.


 Tasks

We may see Task menu in left navigation. This will redirect us to logged in user's task. Here, logged in user may see their task in one/multiple projects. The status of the task is tracking in project server. The status form will  open when user clicked the task name in the grid. User may also send this status to their manager.

Approval

This section is mainly for Project Manager. Here, He may see the task status of the team member. He Approve/Reject the status with comments. An acknowledge will send particular user once the status get approved/rejected.

Summary

I have shared some things about Project Server in SharePoint 2013. :)

Monday, June 16, 2014

Applying toggle type menu for Left Navigation

Introduction

I am going to share my idea about applying toggle for Left Navigation. 

Master Page Customization

We will find the Left Navigation using id sideNavBox in master page. Then, add one <span>  element to have header of toggle on above menu. For Example:

<span class="toggleMenu">Menu</span>
<div class="leftMenu">
        <div id="sideNavBox"></div> (SharePoint Left Navigation Tag)
</div>


Toggle will apply when we click the <span> tag. Paste the below jquery script at the bottom of master page.

<script type="text/javascript">
    $(document).ready(function () {

    $(".toggleMenu").click(function () {
        $(".leftMenu").slideToggle("slow");
    });
</script>

 That's all. Toggle type menu will appear on your page.

Applied screen will be like: