Skip to main content

Posts

Javascript/JQuery Handle Double Click

Recently I have been working on JavaScript/Query & SharePoint client side extensively. I will be posting my learnings during the past one year in the coming few posts.  Recently I was presented with a problem that the custom solution I had provided, did not behave properly when double clicked.  Scrapping through the web, I fumbled on couple of solutions. I personally like the first approach as it is very simple.  First Approach: Click Me $("#clickMe").click(function (e) {     var $this = $(this);     if ($this.hasClass('clicked')){         alert("Double click");         //here is your code for double click         return;     }else{          $this.addClass('clicked');         //your code for single click          setTimeout(function() {                ...

Migrating Lists - Using list templates SharePoint 2013

Recently I came across a strange & unusual behaviour in SharePoint 2013. I was moving stuff from the dev environment to production. One of the most basic task is to move lists. So the usual process of taking a list template from dev to production and creating a list out of the list template. But, Microsoft decided that we will not allow this from SharePoint 2013. Let developers learn some (unnecessary) new stuff. So, the above mentioned basic concept of moving a list will not work in SP 2013. I have absolutely no clue as to why. So the new approach is to use powershell script to create list from the templates. Its a HACK I know, but MS still allows us to do it. First you have to save the list as template and then upload that to production list template gallery. Then change some values below and run it in PowerShell. Thats it, you list will be created. # Get the SiteURL $site = get-spsite("http://YourSite/") # Get the Articles web $web = Get-SPWeb -Identity ...

SharePoint People Editor Control Validation

I was recently working on a visual web part in SharePoint 2013. I added a people editor control on the ascx file. And when I tried to enter the user's name and press enter, the text box started behaving like a multiline textbox. It did not validate the user. Even when I searched for the user and selected, the user did not show up in the textbox. The HTML for the control is simple. I have used this in many other projects. I went crazy. There is so much to learn in SharePoint. SharePoint makes you feel humble, rookie :) This is how the people editor behaved... I tried many things. I even tried to implement Client people picker introduced in SharePoint 2013. Then I stumbled upon a blog by Bill Daugherty II. He had explained about some issue he is facing. Which thankfully worked for me too. http://myspexp.com/2011/03/23/using-the-sharepoint-peopleeditor-in-a-gridview/ The solution was to give a script reference to EntityEditor.js file from _layouts. < script t...

Windows Server 2012 Standard Evaluation Edition Extension

I was recently reviving my Virtual Machine for some testing on SharePoint 2013. I found out that the windows server 2012 standard evaluation license is expired.  Because of this, the VM was getting rebooted every hour. I found out that by running the below script I can stop this from happening. slmgr.vbs -ato But to my surprise it did not work. Because I believe it was already activated. Then I found one more command line script.  slmgr.vbs -rearm This has solved my issue. I can work on SP 2013 peacefully now ;)  

CSS and Javascript tips

I learned 2 interesting things today. 1. After you apply custom style sheet to your content in SharePoint, it is still not getting applied when you check in browser. The reason for that is the SharePoint overrides your style (css class). To over come this situation, you can declare your styles in css class as !important. This lets SharePoint know that your css class is priority. .mediumText {     font-family: Arial !important;     font-size: 9pt !important; } 2. If you want to execute javascript code after successful ASP.net validation of controls (required field validator etc...) you need to write a small javascript function which calls Page_ClientValidate to fire validation and get its status (successful - true; unsuccessful-false). and here is the button markup... Happy Coding Vighnesh Bendre

SharePoint 2013 (SP 15) - Creating Custom Lists

As I am exploring SharePoint 2013, I found out that there are lot of things that are new and there are lot of thing that are old but presented in a different manner as compared to SharePoint 2010. For example, Site Actions was on the top left corner in SP 2010. But in SP 15 (SharePoint 2013) we dont have ‘Site Actions’ button. But instead we have a settings icon which is placed at top right corner. When you click on the settings icon select Add an App. This will basically allow you to add custom lists, documents libraries etc. Add an App is basically the same as More Options in SharePoint 2010. From now on custom lists & libraries will be called apps. Just like in Apple store or Android store you can develop apps for SharePoint and sell it. You can find more information here: http://officepreview.microsoft.com/en-us/store/apps-for-sharepoint-FX102804987.aspx When you click on Add an App you will be navigated to a different scree which will display different opti...