Thursday, December 20, 2012

Data View Paging with Page Numbers

Hi Friends,

I'm making a SharePoint Site to be deployed on the cloud.I didn't want to waste time on deploying Imtech web part issues.So I decided to use the DataView webpart instead since it is 100% OOB and have paging already but I found a problem!:

DataView Paging shows displayed rows numbers not pages numbers...

So after along time of googling,asking MVPs,... I found it is possible only through two ways:

  1. Create a custom web part that inherit the DataView webpart (Same as Imtech idea)
  2. Create new paging for the DataView which requires a lot of XSL coding 

Ofcourse I choosed the second one since the first is similar to deploy an Imtech web part.

Here are screen shots of the DataView after I created a new pager for it using XSL Code only:




I realy like to share with you its code but these days I realy need money since I don't receive a salary at the end of the month anymore.I'm trying to make my own business.In addition for that I need to feel how much my work is worthy...

DataView Other Features:
Reusable from site to another requires only Site Name and List Name
Filtered by Content Type
When there is only one page the pager disappear.
You can customize its design and colors with ease through CSS


Update:

I just finished a more advanced version and yes it uses only XSL:



Additional Features:
  1. Show pages numbers to open the page by its number for the user
  2. Can handle huge number of pages like 100 pages by showing only few page numbers and you can set in the XSL code how many page numbers to show as long as it is an odd number and above 1 (3,5,7,...).For example in the screen shot above I set it to show only 3 page numbers.In case there are less than 3 pages (2) it will show them correctly (1 2).You can see it working online:http://sharepointdevsorg-web.sharepoint.com/news/
  3. First and Last buttons to make paging even easier
Update:
Tested successfully on SharePoint 2007 too.

If you are interested send me an email: nabeelalkaff@gmail.com .I will send you:
DataView Sample code + required CSS and Images + Answer any question about it for two days by email
For only 100$

Hope more success to all of us...

Tuesday, October 30, 2012

Get six months free of ASP.NET Hosting instead of three months

Hi Friends,

I know this is not a SharePoint subject but after all any SharePoint developer must have experience in ASP.NET since it depends on it.I just wanted to host a site I have few days ago on a hosting company.I opened brinkster site but I didn't find their 50% discount anymore?!

So I opened another well known hosting company site Discountasp.net.They have 3 months for free.I observed their is a promotion code entry below.I searched about it and I found they give 6 months free instead of 3 months if you enter the word TWEET in the promotion code entry then click Activate Promo.I did that and I have 6 months free instead of 3 ! .So if you are interested in hosting asp.net sites like me give it a try (You should see you got 6 months free as soon as you enter the promotion code before doing any real payment):
ASP.NET Hosting - 3 Months Free - Click Here!!

After you click the link above click "Click Here To Sign Up" red button and you will see the page I'm talking about in this article...

Another thing I observed in their hosting is the database hosting is separated so it is not covered in the promotion.But if you choose SQL Server 2012 hosting you will get 1 GB database size instead of 500MB.

Hope to all of us more success...

Tuesday, October 2, 2012

Custom Sites Templates Where did they go ?

There are two ways to create custom templates:
  1. Creating Custom Site Template From Scratch using Site Definition
  2. Creating Custom Site Template Fom Existing One

The one I will be talking about here is the second one.I started from a TeamSite then after many changes I made I saved it as Template.However I wanted to add a subsite to my Publish Main Site using that Custom Template but when I click new site I cannot see my custom template ?!

First thing you should check is Site Layouts And Templates gallery in the site settings.If you find your custom template there you need only to add it to the templates available for your site.

If you didn't find your custom template in the template gallery then you can try the following approach :

I found that Publish Sites always have problems with Custom Templates.So I just disabled the Publish Sites Feature temporary then when I click New Site I see my custom template !

After I created the subsite I returned to my main Publish Site and enabled the Publish Sites Feature again.

Whatever you have better ideas or facing a problem please share with us your comment...

Uploading Files To SharePoint Site Causing Errors

One problem I was facing long time ago occured while I was uploading some .vlf files.

Well I learned from that day I should always check 2 things immediatly:
In Central Administration > Security > Block File Types
So check if .flv for example is mentioned there which mean it is blocked and remove it from the blocked types list but this wasn't my problem.

The problem was the maximum size for uploading.From Central Administration > Manage Web Applications > select your web application then from the ribbon select General Settings there you will find the maximum permitted size for a file to be uploaded so I increased it as I need and the error vanished.

See you again in another article and another SharePoint adventure...  

Hiding Left Menu from your page

There are three approaches you need to know about this subject.

First Approach:

From the configuration side you can hide the Quick Launch menu from the Site Settings in the Look and Feel section where there is TreeView which includes the settings to Show/Hide TreeView or Quick Launch menu.

Second Approach

In the first approach only the Quick Launch will be hidden but the Left Navigation Area will still appear with the Recycle Bin link and this is not what you want so what could you do?

You can create a new Page Layout  and include an empty asp:Contant element in its HTML code with the PlaceHolderId set to "PlaceHolderLeftNavBar" and the whole navigation area will be hidden in any page using the Page Layout you just created.

Third Approach

You need to hide the Left Navigation Area from an existing Page Layout in some pages only so what could you do?

You can add a Content Editor webpart and in its HTML Content add the following:
<style>
#s4-leftpanel
{
display:none;
}
</style>

Then publish the page...
If you face any problem related to this subject or have any comment please add your comment below and I will reply to you as soon as possible...

Thursday, August 16, 2012

Clean Simple Event Handlers

One of the projects I worked on was using SharePoint 2007.One of the subsites contiains many lists and each one requires some calculation and validation whenever you add or update or delete an item.One of the reasons we made that was the fact SharePoint 2007 doesn't support cascading.A developer worked on the project and used a third party tool to add cascading fields for SharePoint lists and he also used a custom solution he downloaded to attach event handlers for each list he choose.

Well I prefer to avoid these things so I made my own event handlers in SPItemEventReciever and deploy it as a feature.

Just for time saving and because almost all the lists in that site require custom code otherwise it is better to follow a different approach so a different handler is called foreach list instead of one handler for all lists.I will talk about using specific handler foreach list in another article later.

After I deployed my custom SPItemEventReciever feature the surprise was whatever my code is correct or has some errors other things happen even that I can debug my code?!!

So I decided to uninstall all the custom solutions and the Third Party tool for cascading.

I remembered that I used U2U tool (windows application) in the past to explore handlers for the SharePoint List and Remove it.

Unfortunatily I found that tool doesn't exist any more on the web and I don't have time to search for the U2U I copied on another machine 2 years ago.

I searched the web and after around one hour I found a similar tool in codeplex:
http://spstipsutilitypack.codeplex.com/

Using that tool I found there was some custom handlers still attached for the site lists so I removed them.

After that (at last) my custom reciever class handlers handled the site lists events successfully.  

Why making organization chart while it does exist already?!

A rule any SharePoint developer must follow:
You must check existing OOB Web Parts and Features before creating custom work and waste very long time on something that already exist.

In SharePoint 2007 making a custom Organization Chart was the correct choice because there was no OOB Organization Chart but now you shouldn't go for that immediatly since it does exist in SharePoint 2010:





However like any other component in SharePoint it needs some configuration.But unlike many other components some of these configurations should be done first in the Active Directoy.For example to make several employees belongs to the same department (as colleagues) under one manager you should go to the properties for that user in the Active Directory and set in the Organization tab who is the manager for that user and what is the department he works in.

If this OOB Organization chart does not cover the customer requirements then you will need to use a custom Organization Chart webpart like the following:
http://orgchartpart.codeplex.com/

Good Luck!