Prasad Bolla's SharePoint Blog

Click Here to go through the Interesting posts within my Blog.

Click Here to go through the new posts in my blog.

Thursday, February 28, 2013

How to Open the Admin Recycle Bin in SharePoint 2013



There is no option to go to Admin Recycle Bin directly in SharePoint 2013 Site. To Go to Admin Recycle Bin follow the below steps. 

  1. Type Your Site Url in the Browser.
  2. Along with it give this way (SharePointSiteURL/_layouts/15/AdminRecycleBin.aspx?View=2).
  3. Now you can open Admin Recycle Bin where you can delete your items not needed permanently.

Where do we find Recycle Bin in SharePoint 2013



  1. Login to your site.
  2. Go to Site Settings Next to your UserName.
  3. In Site Settings click on Site Content.
  4. Now after going to the Site Content Page you will find the Recycle Bin.

How to Enable Document Set Feature in SharePoint 2013



  1. Login to your SharePoint Site with Valid Credentials.
  2. Go to Settings on the right side of your page (Next to your username).
  3. Click on Settings àSite Settings.
  4. In Site Settings Page go to Site Collection Administration Category.
  5. Now click on Site Collection Features.
  6. In the Site Collection Features page you will find Document Set Feature.
  7. Now click on Activate.

Wednesday, February 27, 2013

Implement Simple Rating Concept in GridView using SharePoint List Data



OutPut:-

Images I have used to achieve this functionality:-







Steps:-
  1. Create a New Custom SharePoint List.
  2. Create a Column of Number Type “Rating”.
  3. Specify column as a Required Field.
  4. Specify a Range of 0 to 5 in the rating Column.
  5. Set Default Value as 0 in Default Value of the Rating Column.
  6. Now Create the Names of the Images as given below.
For Rating we will use numbers 0 to 5 Range. So Create the Image Names like this given below and upload them them to the Document Library.
  • 0Star.png
  • 1Star.png
  • 2Star.png
  • 3Star.png
  • 4Star.png
  • 5Star.png
Ascx
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RatingGridViewUserControl.ascx.cs" Inherits="RatingGridView.RatingGridView.RatingGridViewUserControl" %>
<asp:GridView ID="dgvRating" runat="server" AutoGenerateColumns="False"
    Width="100%" CellPadding="4" EnableModelValidation="True" ForeColor="#333333"
    GridLines="None">
    <AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField HeaderText="Article Name" DataField="Title" />
<asp:TemplateField HeaderText="Rating">
<ItemTemplate>
<img src="/UserPages/StarImages/<%# Eval("Rating") %>Star.png" height="55px" title="<%# Eval("Rating") %>Star" />
</ItemTemplate>
<AlternatingItemTemplate>
<img src="/UserPages/StarImages/<%# Eval("Rating") %>Star.png" height="55px" title="<%# Eval("Rating") %>Star" />
</AlternatingItemTemplate>
</asp:TemplateField>
</Columns>
    <EditRowStyle BackColor="#7C6F57" />
    <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
    <RowStyle BackColor="#E3EAEB" />
    <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
</asp:GridView>
Ascx.Cs
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using System.Security;

namespace RatingGridView.RatingGridView
{
    public partial class RatingGridViewUserControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            getRatingData();
        }

        public void getRatingData()
        {
            try
            {
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    SPQuery sQuery = new SPQuery();
                    sQuery.Query = "<OrderBy><FieldRef Name=\"ID\" Ascending=\"False\" /></OrderBy>";
                    SPListItemCollection myColl = SPContext.Current.Web.Lists["New Articles"].GetItems(sQuery);
                    if (myColl.Count > 0)
                    {
                        dgvRating.DataSource = myColl.GetDataTable();
                        dgvRating.DataBind();
                    }
                });
            }
            catch (Exception Ex)
            {
                Response.Write(Ex.ToString());
            }
        }
    }
}