Tuesday, December 18, 2012

Developer Tool for internet explorer IE not showing

Switch to the application (Developer Tool), say by clicking on its taskbar button or by Alt+Tab'ing to it.

Then type Alt+Space to call up the System menu

Sunday, November 4, 2012

How to point to a custom 404 error Web page in SharePoint 2007 and 2010

Change SharePoint Page Title

Change SharePoint Page Title

Add the follwing content place holder in the top of your code if not exist
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
Add Title here

</asp:Content>
You can get title dynamic by add any of this tags into "PlaceHolderPageTitle"

<SharePoint:ListProperty Property="Title" runat="server"/>

<SharePoint:ListItemProperty Property="Title" runat="server"/>

<SharePoint:ProjectProperty Property="Title" runat="server"/>

<SharePoint:ListFormPageTitle runat="server"/>

Friday, November 2, 2012

Error when you delete a solution in Stsadm

Sometimes you face a Job schedule error once you try to delete solution in stsadm

stsadm -o enumdeployments

extract the id of the job then execute the command:

stsadm -o canceldeployment -id e68fbd7b-9442-4efe-b0ee-67023b172740

stsadm -o deletesolution -name HighLightMOSS.wsp

Sunday, October 14, 2012

Sharepoint Arabic Site and Menu Issue Navigation Right to left

facing an issue on Firefox, Safari, Chrome it seems to be a CSS issue, Sharepoint Arabic Menu

Just using following css:

.menu ul.dynamic {
    positionabsolute;
    right0;
    z-index-1;
}

Sunday, October 7, 2012

Elevated privileges in Sharepoint c#

You should create the SPWeb object within the Elevated privileges block, you shouldn't get the object from SPContext.
So, instead of this statement 'spWeb = SPContext.Current.Web' try to create a object
SPSite site = new SPSite();
SPWeb spWeb = site.OpenWeb();
and use this spWeb to call EnsureUser method.
Hope this should work.

Monday, August 13, 2012

RBS - Sharepoint 2010 (Troubleshoot)

in case you receive any error in the log during RBS installation:

1. try to uninstall RBS using cmd : "msiexec /x RBS.msi"

2. Execute the following:

msiexec /qn /i rbs.msi REMOTEBLOBENABLE=1 FILESTREAMPROVIDERENABLE=1 DBNAME="WSS_Content_100" DBINSTANCE=”nidal-pc2008\MSSQLSERVER" FILESTREAMSTORENAME=FilestreamProvider_1 ADDLOCAL=Client,Docs,Maintainer,ServerScript,FilestreamClient,FilestreamServer

Thursday, June 21, 2012

Telerik in Sharepoint

1. Add the folowing to the masterpage

<%@ Register assembly="Telerik.Web.UI, Version=2012.2.607.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" namespace="Telerik.Web.UI" tagprefix="telerik" %>


2. Cut and past the folowing from your code to the masterpage:

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
     <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadGrid1">
             <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
             </UpdatedControls>
         </telerik:AjaxSetting>
     </AjaxSettings>
</telerik:RadAjaxManager>


3. Remove the folowing from your code (Webpart,..) as a Script Manager tag exist on sharepoint masterpage:

<telerik:RadScriptManager ID="RadScriptManager1" runat="server" />

4. If you receive in error regarding "EventValidation" go to the site web.config and change the value to :
<

 5. Some times you need to enable session state, do the folowing steps:
http://moustafa-arafa.blogspot.com/2010/05/how-to-enable-session-state-in.html
enableEventValidation
pages enableEventValidation="false"

Friday, June 15, 2012

Tree View

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>
<script runat="server">
    public void OnClick(Object sender, EventArgs e)
    {
        Label1.Text = "You selected " + TreeView1.SelectedNode.Value+ ".";
    }
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
        <asp:TreeView ID="TreeView1" runat="server" OnSelectedNodeChanged="OnClick" OnAdaptedSelectedNodeChanged="OnClick"
            onload="TreeView1_Load">
        </asp:TreeView>
   
    </div>
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    </form>
</body>
</html>

CS File

protected void TreeView1_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

TreeNode Node = new TreeNode("Parent");

Node.SelectAction = TreeNodeSelectAction.SelectExpand;

TreeView1.Nodes.Add(Node);

TreeNode ParentNode = Node;

TreeNode node2 = new TreeNode("child1", "http://ge");

node2.SelectAction = TreeNodeSelectAction.SelectExpand;

ParentNode.ChildNodes.Add(node2);

TreeNode node3 = new TreeNode("child2");

node3.SelectAction = TreeNodeSelectAction.SelectExpand;

node2.ChildNodes.Add(node3);

}

}

Monday, June 4, 2012

Programmatically Copy files with SharePoint 2010

usingMicrosoft.SharePoint;

usingSystem.Collections.Generic;
public void CopyFiles(SPFileCollection collFile)
{foreach (SPFile oFile in collFile)

{

oFile.CopyTo(
"http://spsrv:502/target" + "/" + oFile.Name, true);

}

}

private void EnumerateFolders(SPFolderCollection copyFolders)

{

foreach (SPFolder subFolder in copyFolders)

{

if (subFolder.Name != "Forms")

{

SPFileCollection subFiles = subFolder.Files;

CopyFiles(subFiles);

}

SPFolderCollection subFolders = subFolder.SubFolders;

EnumerateFolders(subFolders);

}

}

 

 

protected void Button1_Click(object sender, EventArgs e)

{

 

 

 

 

SPWeb web = SPContext.Current.Web;

SPFolder oFolder = web.GetFolder("Shared%20Documents");

SPFileCollection collFile = oFolder.Files;



//Copying files from the Root folder.

CopyFiles(collFile);



// Get the sub folder collection

SPFolderCollection collFolder = oFolder.SubFolders;



EnumerateFolders(collFolder);

 



}

Thursday, May 24, 2012

add position to a classname jquery

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

$('ul').children().each(function(index) {
  $(this).addClass("liclass"+index));
});

});
</script>

Thursday, May 10, 2012

Arabic web-browser font (successful convertion)

بالنسبة للطريقة استعملت برنامج FONTCREATOR للتحويل من صيغة OTF إلى TTF
أما بالنسبة للتحويلات الأخرى إليك الموقعين الذين أستعملتهما ..
http://ttf2eot.sebastiankippe.com/
http://orionevent.co...m/otf2woff.html Convert otf to woff

Saturday, April 28, 2012

JQuery Use Multiple instance in one page

JQuery Use Multiple instance in one page

Multiple function call (Tab) in single page

http://jsfiddle.net/RwPps/


$(document).ready(function() {

$(".myTabs").each(function() {

var $myTabs = $(this);

$myTabs.find(".tab_content").hide().first().show();
$myTabs.find("ul.tabs li:first").addClass("active").show();

$myTabs.find("ul.tabs li").click(function() {
var $this = $(this);

$this.addClass("active").siblings().removeClass("active");
$this.find(".tab_content").hide();

var activeTab = $this.find("a").attr("href");
$(activeTab).fadeIn();

return false;
});
});

});





<div class="myTabs" id="myTabs1">
<ul class="tabs">
<li><a href="#tab1">Gallery</a></li>
<li><a href="#tab2">Submit</a></li>
</ul>

<div class="tab_container">
<div id="tab1" class="tab_content">
<!--Content-->
</div>
<div id="tab2" class="tab_content">
<!--Content-->
</div>
</div>
</div>

<div class="myTabs" id="myTabs2">
<ul class="tabs">
<li><a href="#tab3">Gallery</a></li>
<li><a href="#tab4">Submit</a></li>
</ul>

<div class="tab_container">
<div id="tab3" class="tab_content">
<!--Content-->
</div>
<div id="tab4" class="tab_content">
<!--Content-->
</div>
</div>
</div>




Friday, April 27, 2012

JQuery Scripts

 1. Accordion for Left Navigation in sharepoint 2010

Make sure "addClass" fuction will be after "this", add has('ul') for the folder that doesnt have child to be linkable not acordion

<script src="/Style%20Library/js/jquery-1.7.1.min.js" type="text/javascript"></script> 
  
<script type="text/javascript">

$(document).ready(function()

   $("div.menu-vertical>ul.root>li.static:has('ul')>a").toggle(
    function () {
        $(">ul", $(this).addClass("t-active").parent()).show("fast");
    },
    function () {
        $(">ul", $(this).removeClass("t-active").parent()).hide("fast");
    }
);

$("div.menu-vertical>ul.root>li.static>ul.static").css("display","none");

});
</script>




2. Find a text and replace it by white space, add class

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

     $('.menu-horizontal span.menu-item-text:contains("الرئيسية")').addClass('home');
    $('.menu-horizontal span.menu-item-text:contains("الرئيسية")').html(function(i, h) {
     return h.replace('الرئيسية', '');
    });
 
 }); 
 </script>




3. Add a content (image,..)  inside a tag (div...) with parent function
to get multiple level of parent we can use parent().parent().parent()
$(document).ready(function () { 

  $('.menu-horizontal span.menu-item-text:contains("الرئيسية")').parent().prepend('<img src="/Style Library/en-us/images/icon-home.gif" width="15px"></img>');
    
 });

Saturday, April 14, 2012

Style SharePoint 2010 Web Parts

How to Style the Header of the Standard SharePoint Web Parts

The Web Parts in SharePoint render in tables, and each header row contains five cells. You can use the ms.WPHeader class for the table header row, and you can modify all the cells in that row.
Example 1 shows how to apply a gray background color for the Web Part table header row and its cells.



Figure 2. Gray background color for Web Part table header

Gray background color for Web Part table header
Add the following CSS to your custom CSS file.
/* All cells (TDs) in the table row (TR) */
.ms-WPHeader TD{
background-color: #f7f7f7;
border-bottom:1px transparent!important;
padding:3px;
}
/* Web Part title */
.ms-WPTitle {
color: #333;
font-weight:bold;
}
/* Linked title and visited */
.ms-WPTitle a, .ms-WPTitle a:visited {
color: #333!important;
text-decoration:none!important;
}
/* Hover */
.ms-WPTitle a:hover {
color:red!important;
}
If you want a border around the header, you can set top and bottom borders for all cells in the row, but because the first and the last cells use the same class name, you can use first:child to separate the start and the ending cell.



Figure 3. Border applied to header

Border applied to header
To apply a border around the header of all Web Parts on the SharePoint page, add the following CSS to your custom CSS file.
/* All TDs in the table row */
.ms-WPHeader TD{
background-color: #f7f7f7;
border-top:1px #ccc solid!important;
border-bottom:1px #ccc solid!important;
padding:3px;
}
/* Border to the sides */
.ms-WPHeader td:first-child {
border-left:1px #ccc solid;
border-right:0px!important;
}
.ms-wpTdSpace {
border-right:1px #ccc solid!important;
}
/* Web Part title */
.ms-WPTitle {
color: #333;
font-weight:bold;
}
/* Linked title and visited */
.ms-WPTitle a, .ms-WPTitle a:visited {
color: #333!important;
text-decoration:none!important;
}
/* Hover */
.ms-WPTitle a:hover {
color:red!important;
}



Figure 4. Border applied to header and body of Web Parts

Border applied to header and body of Web Parts
To apply a border around the header and to the body of all Web Parts on the SharePoint page, insert the following CSS in your custom CSS file.
/* Webpart table */
.s4-wpTopTable{
padding:0px!important;
margin:0px!important;
border:1px #dbddde solid!important;
}
/* All TDs in the table row */
.ms-WPHeader TD{
background-color: #f7f7f7;
border-bottom:1px #ccc solid!important;
padding:2px;
}
/* Web Part title */
.ms-WPTitle {
color: #333;
font-weight:bold;
}
/* Linked title and visited */
.ms-WPTitle a, .ms-WPTitle a:visited {
color: #333!important;
text-decoration:none!important;
}
/* Hover */
.ms-WPTitle a:hover {
color:red!important;
}
The next example shows how to adjust other elements that have been affected by setting a border to the body of the Web Parts. The s4-TopTable general class is used by several other elements in SharePoint. For example, the Search box uses this class, and if you don’t want a border around this element, you can use the following code to specifically set the Search box not to use a border.
.s4-search Table, .s4-wpcell-plain {
 border:0px!important;
}

How to Use Rounded Corners for the Web Part Title

Rounded corners are often used to give a user interface a more modern appearance. There are several ways to create rounded corners. This example applies background images for the corners and for the middle section. The left and right corners have dimensions of 7 x 33 pixels, and the middle image has dimensions of 14 x 33 pixels.



Figure 5. Web Part headers with rounded corners

Web Part headers with rounded corners
To create rounded corners for all Web Part headers in the SharePoint page, insert the following CSS in your custom CSS file.
/* All TDs in the table row */
.ms-WPHeader TD{
background-image: url('/Style Library/MSDN/Images/WP-mid.jpg');background-repeat:repeat-x;
border:0px!important;
border-top:1px #fff solid!important;
padding-left:1px; padding-right:1px;
height:33px
}
/* Left cell */
.ms-WPHeader td:first-child {
width:5px;
background-image:url('/Style Library/MSDN/Images/WP-left.jpg')!important;background-repeat:no-repeat;
}
/* Right cell */
.ms-wpTdSpace {
width:7px;
background-image:url('/Style Library/MSDN/Images/WP-right.jpg')!important;background-repeat:no-repeat;
background-color:transparent!important;
}
/* Arrow */
.ms-WPHeaderTdMenu{
background-color:transparent!important;
border:0px!important;
}
/* Content in the Web Part */
.ms-wpContentDivSpace {
padding:10px!important;
margin:0px!important;
border:0px!important;
}
/* Web Part title */
.ms-WPTitle {
padding-left:10px;
font-family:Arial, Helvetica, sans-serif!important;
color: #fff;
font-weight:bold;
}
/* Linked title and visited */
.ms-WPTitle a, .ms-WPTitle a:visited {
color: #fff;
text-decoration:none!important;
}
/* Hover title */
.ms-WPTitle a:hover {
color:#333!important;
text-decoration:none!important;
}



Figure 6. Web Part headers with rounded corners and borders applied

Web Part headers with rounded corners and borders
To create rounded corners for the Web Part headers and to set borders for all Web Parts in the SharePoint page, insert the following CSS in your custom CSS file.
/* All TDs in the table row */
.ms-WPHeader TD{
background-image: url('/Style Library/MSDN/Images/WP-mid.jpg');background-repeat:repeat-x;
border:0px!important;
border-top:1px #fff solid!important;
padding-left:1px; padding-right:1px;
height:30px
}
/* Left cell */
.ms-WPHeader td:first-child {
width:5px;
background-image:url('/Style Library/MSDN/Images/WP-left.jpg')!important;background-repeat:no-repeat;
}
/* Right cell */
.ms-wpTdSpace {
width:7px;
background-image:url('/Style Library/MSDN/Images/WP-right.jpg')!important;background-repeat:no-repeat;
background-color:transparent!important;
}
/* Arrow */
.ms-WPHeaderTdMenu{
background-color:transparent!important;
border:0px!important;
}
/* Content in the Web Part */
.ms-wpContentDivSpace {
padding:10px!important;
margin:0px!important;
margin-top:0px!important;
border:0px!important;
border:1px #dbddde solid!important;overflow:hidden
}
/* Web Part title */
.ms-WPTitle {
padding-left:10px;
font-family:Arial, Helvetica, sans-serif!important;
color: #fff;
font-weight:bold;
}
/* Linked title and visited */
.ms-WPTitle a, .ms-WPTitle a:visited {
color: #fff;
text-decoration:none!important;
}
/* Hover title */
.ms-WPTitle a:hover {
color:#333!important;
text-decoration:none!important;
}

Monday, February 6, 2012

Add XML Flash animation to sharepoint masterpage

1. First Copy the flash files (swf+XML) to a sharepoint foder(ex. "/flash")

2. Set the webapplication to permessive mode.

3. Check out and check in all the files (flash, xml, images files) in sharepoint folder

4. All references to images.xml and settings.xml need to be changed to relative (ex. /flash/images.xml)
so you may change:
a. swf file  (search for images.xml and settings.xml path and change it to relative)
b. settings.xml file
c. images.xml file (change images links to relative too)

3. Add something like this to the masterpage:
<script type="text/javascript" src="/Style%20Library/js/swfobject.js"></script>
  <script type="text/javascript">
   var flashvars = {};
   flashvars.settingsXML = "/flash/settings.xml";
   var params = {};
   params.scale = "noscale";
   params.salign = "tl";
   params.wmode = "transparent";
   params.allowfullscreen = "true";
   var attributes = {};
   swfobject.embedSWF("/flash/banner.swf", "BannerDiv", "975", "221", "9.0.0", false, flashvars, params, attributes);
  </script>



  <div id="BannerDiv">
   <a href="http://www.adobe.com/go/getflashplayer">
    <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
   </a>
  </div>