Wednesday, 22 August 2012

Custom Bread Crumb

.ascx
------
<div class='bedcrumb'>                                                            

<span style='text-transform:capitalize;'>

<asp:Label ID="lblBreadcrumb" runat="server"></asp:Label>

</span>

</div>


.ascx.cs
----------

StringBuilder
sb = null;

string weburl = SPContext.Current.Web.Url + "/";

public void Page_Load(object sender, EventArgs e)

{

lblBreadcrumb.Text = getbreadcurmb();

}


public string getbreadcurmb()

{string webname1 = SPContext.Current.Web.Title;
sb =new StringBuilder();
string CurrentPageUrl = Request.Url.AbsoluteUri;
string[] ary = CurrentPageUrl.Split('/');
string pagename = ary[ary.Length - 1];
SPWeb web = SPContext.Current.Web;
if (web.IsRootWeb)
{

sb.Append(
"<a href='" + weburl + "'>" + webname1 + "</a>"+">");

if (pagename.Contains("?"))

{

sb.Append(pagename.Split(
'?').GetValue(0));

}else
{
sb.Append(
" " + pagename.Replace(".aspx", "").Replace("-", " "));

}

}
else
{if (web.ParentWeb.IsRootWeb)

{string parentweb = SPContext.Current.Web.ParentWeb.Title;
string parrenturl = SPContext.Current.Web.ParentWeb.Url;
sb.Append("<a href='" + parrenturl + "'>" + parentweb + "</a>" + ">" + "<a href='" + weburl + "'>" + webname1 + "</a>" + ">");
if (pagename.Contains("?"))

{

sb.Append(pagename.Split(
'?').GetValue(0));

}else
{

sb.Append(
" " + pagename.Replace(".aspx", "").Replace("-", " "));

}

}
else
{
 
if (web.ParentWeb.ParentWeb.IsRootWeb)

{

string parentweb1 = SPContext.Current.Web.ParentWeb.ParentWeb.Title;

string parentweb2 = SPContext.Current.Web.ParentWeb.Title;

string parrenturl1 = SPContext.Current.Web.ParentWeb.ParentWeb.Url;

string parrenturl2 = SPContext.Current.Web.ParentWeb.Url;

sb.Append("<a href='" + parrenturl1 + "'>" + parentweb1 + "</a>" + ">" + "<a href='" + parrenturl2 + "'>" + parentweb2 + "</a>" + ">" + "<a href='" + weburl + "'>" + webname1 + "</a>" + ">");

if (pagename.Contains("?"))

{

sb.Append(pagename.Split(
'?').GetValue(0));

}

else

{

sb.Append(
" " + pagename.Replace(".aspx", "").Replace("-", " "));

}

}

else

{

string parentweb1 = SPContext.Current.Web.ParentWeb.ParentWeb.Title;

string parentweb2 = SPContext.Current.Web.ParentWeb.Title;

string parrenturl1 = SPContext.Current.Web.ParentWeb.ParentWeb.Url;

string parrenturl2 = SPContext.Current.Web.ParentWeb.Url;

string parrentweb3 = SPContext.Current.Web.ParentWeb.ParentWeb.ParentWeb.Title;

string parrenturl3 = SPContext.Current.Web.ParentWeb.ParentWeb.ParentWeb.Url;

sb.Append( "<a href='" + parrenturl3 + "'>" + parrentweb3 + "</a>" + ">" +"<a href='" + parrenturl1 + "'>" + parentweb1 + "</a>" + ">" + "<a href='" + parrenturl2 + "'>" + parentweb2 + "</a>" + ">" + "<a href='" + weburl + "'>" + webname1 + "</a>" + ">");

if (pagename.Contains("?"))

{

sb.Append(pagename.Split(
'?').GetValue(0));

}

else

{

sb.Append(
" " + pagename.Replace(".aspx", "").Replace("-", " "));

}

}

}

}

return sb.ToString();

}

Monday, 20 August 2012

Shareopint Helper

Add Solution
-------------

Add-SPSolution “C:\Users\Administrator\Desktop\WSP\LIST.wsp“

Update
-------
Update-SPSolution -Identity LIST.wsp -LiteralPath C:\Users\Administrator\Desktop\WSP\LIST.wsp -GACDeployment

FEATUERS ACTIVATE STEPS
------------------------
1. LIST
2. MAIN PAGE(WEBPART)
3. WEB CONFIG
4. MASTER PAGE
5. PAGES

SharePoint online - Get List-item attachments and Display to div

Step 1 : Create a List ex: TestList and attach few images Step 2 : Copy and Pastet the below coding in App.js var  Items =  null ; ...