Posts

Showing posts from April, 2010

Developing SharePoint Applications - Aug 2009

SharePoint 2007 Guidance. https://cid-93ccfb4bef6f3711.skydrive.live.com/self.aspx/Documents/Developing%20SharePoint%20Applications%20-%20Aug%202009.pdf

JQuery UI Dialog with ASP.NET & SharePoint

Image
  Ref: http://blog.roonga.com.au/2009/07/using-jquery-ui-dialog-with-aspnet-and.html One of the first things you will notice when you try and use JQuery UI Dialog in ASP.Net page is it does not perform post backs from within the dialog window. This is because in a ASP.Net page there is only one form element and Jquery appends the dialog "div" outside of the form element. There is a easy way to fix this. And once its done then its simple matter of combining some ASP.Net AJAX Update Panels and you are ready to go. Lets look at a simple but non-trivial example of combining JQuery UI Dialog, Asp.Net and AJAX Update Panel. You can download the source of the sample here . Our sample application will display a list of names. To edit a name, you click on a name. This will pop up a JQuery UI Dialog with the current name. You can edit the name and click save. This will save and automatically close the dialog. For adding a new Name, click on the "A...

Referencing Javascript Files with SharePoint 2010 Custom Actions using SciptSrc

Ref: http://weblogs.asp.net/jan/archive/2010/03/01/scriptsrc-referencing-javascript-files-with-sharepoint-2010-custom-actions.aspx If you’re an avid reader of this blog, you are probably aware of the fact that using Javascript plus SharePoint is a very powerful combination. In SharePoint 2007 there were a couple of techniques you could use to make sure your Javascript files would be referenced by SharePoint pages: Add the Script reference to the Master Page Use a Delegate Control (e.g. the AdditionalPageHead) Dynamically through code, e.g. in a Web Part Although all those techniques work, and will still work in SharePoint 2010, they all have some limitations. The first technique requires you to build a custom Master Page, which may be a little overkill just to get a Javascript file referenced. Additionally, your custom Master Page is not used on Application Pages (unless you use the Superbranding trick ). The second is my favorite one in ShareP...

JQuery conflict with SharePoint 2010 JavaScript Libraries

  I have lost nearly a day to fix the JQuery not run in SharePoint site. It’s really strange that there is only 1 page in the site that JQuery could not run. And It’s very hard to figure out what is the problem. No I found it, the JQuery library conflict with SP.js of SharePoint 2010. We shoud change the code like this: var $j = jQuery.noConflict(); // Use jQuery via $j(...) $j(document).ready( function () { $j( ".someclass" ).hide(); }); So, in the above code, we actually referring the $j() instead of directly $(), so it won't give any problems in future. No matter what how many different client side javascript technologies used, that should work. Please go here for more information: http://docs.jquery.com/Using_jQuery_with_Other_Libraries

Enabling a Button on the Ribbon Based on Selection

Image
Ref: http://blogs.msdn.com/sharepoint/archive/2010/02/15/enabling-a-button-on-the-ribbon-based-on-selection.aspx A lot of people have asked me how to create a button which enables if and only if a single item is selected. This isn’t something we have out of the box, but the code to get this functionality is pretty simple. I’m going to assume that you’re generally familiar with SharePoint, CustomActions, and customizing the Ribbon – if that’s not the case, you’d probably be better off researching those things before delving into this. Basically, the enabling behavior all boils down to the following few lines of code: EnabledScript = " javascript:function singleEnable() {   var items =     SP.ListOperation.Selection.getSelectedItems();   var ci = CountDictionary(items);   return (ci == 1); } singleEnable(); " What this does is query to get the dictionary of selected items, and if the size of the dictionary ...

SharePoint Dialog Auto-Sizing and Master Page Customization

Image
  SharePoint web dialogs bring an exciting new UI feature: they can auto-size to the content of a hosted page. Auto-sizing works by examining the contents of your page during page load, and setting the size of the dialog accordingly. Unfortunately, this feature can be speed bump on the road to master page customization. This post will describe the master page customization process necessary to keep dialog auto-sizing working with your master pages. The most important thing to note is that the auto-sizing feature is aware of whether the ribbon is fixed at the top of the screen. It is important to know whether your master page has the ribbon fixed at the top of the screen or not in order to customize it to work well with auto-sizing. A ribbon fixed on top of the screen looks like this, with the page content below the ribbon scrollable separately from the ribbon itself:   If the ribbon is fixed at the top of the screen, be sure the following statements about your maste...