Tuesday, November 2, 2010

SharePoint 2010 Work Flow (WF) Quick Hits

SharePoint Work flows are pretty strait forward for the most part but there are a couple items that are worth remembering. Some of them I have had to learn twice so this list I’ve made to review before I do WF implementations, in an effort to not have to learn things a third time :)

These notes are specific to Work Flows in SharePoint Designer.

1. Always save then publish.

2. If you have a test page open after the WF has been updated reload the page before initiating the WF. SharePoint will force you to do this anyway but you can lose any changes you made to test the WF.

3. When sending an e-mail via WF using a look-up person value select e-mail address, semicolon delimited for the look-up value.

4. In general, if you are using a look-up values in the WF verify it is not empty (Null) before using. If the error, Coercion Failed: Input cannot be null for this coercion, it is because a field has a null value or is empty. The Fix is to use the conditional IF-Else construct to check for Null before executing the actions, example: IF field is not empty.

5. A record seems to only be updateable by a WF once.

6. Conditional statements like IF-Else don’t move up and down so well in the WF step.

7. To create a state machine using a WF
a. Create a list or column to contain a copy of the field(s)
b. Seed the field with a copy of the content
c. Create a WF that accounts for the following conditions
d. Initial creation of the list item
i. Might be necessary to seed the list or column
e. On value change account for the following conditions
i. Different Content -> Previous Content is different
ii. Different Content -> Previous Content was Blank
iii. Current Content is Blank - > Previous Content was not
iv. Blank -> Blank
1. No action should be required as the state did not change
f. For an example / more information on how to do this see this link: http://office.microsoft.com/en-us/sharepoint-designer-help/watch-this-run-a-workflow-when-a-specific-field-changes-HA010256419.aspx

8. Hyperlinks made in the WF e-mail editor can be copied and pasted but the pasted version may need the link to be adjusted. Look-ups used in the e-mail editor cannot be copied and pasted.

Monday, October 11, 2010

Silverlight User Control Navigation Solution

There are two solution approaches when implementing a navigation solution, the capability to navigate between pages using Silverlight. One approach is to use user controls and is what this write-up focuses on the other approach which was recently added in Silverlight 4. For the most part this is a summary of the demo video provided by Jesse Liberty from Microsoft.

Steps for Creating a User Control Navigation solution
1. Create Silverlight Application
2. Add a new page called NavigationFrame
a. Delete the Grid control LayoutRoot in the NavigationFrame.xaml file
b. In the code behind file add the code below to the constructor to load a default page in this example it is the main page

if (this.Content == null)
{
this.Content = new MainPage();
}

c. Add a navigate method to change the content displayed in the page

public void Navigate(UserControl nextPage)
{
this.Content = nextPage;
}

3. Update the App.xaml.cs to load the NavigationFrame Page instead of the MainPage on Application load
a. In the Application_Startup method change MainPage to NavigationFrame
4. Create another Silverlight page called Page_2
5. Add navigation Controls
a. In my case I am using buttons for navigation and added them to both pages (MainPage and Page_2)

<button name="buttonSwitch" type="submit" width="75" content="Switch" height="23" horizontalalignment="Left" margin="132,212,0,0" verticalalignment="Top" click="Switch_Click">

6. In the code behind of both MainPage and Page_2 the even handler needs to be added to swap between the target pages
a. Example of code behind for Page_2

private void Switch_Click(object sender, RoutedEventArgs e)
{
NavigateFrame ps = this.Parent as NavigateFrame;
ps.Navigate(new MainPage());
}





Reference: User Control Implementations
Jesse Liberty Demo Video - http://www.silverlight.net/learn/videos/silverlight-videos/using-multiple-pages-part-1/
Slightly Different implementation use a service approach- http://nerddawg.blogspot.com/2008/06/pages-in-silverlight.html
Similar example - http://www.c-sharpcorner.com/UploadFile/nipuntomar/Silverlight07082008154003PM/Silverlight.aspx

Navigation Application (SL4)
Basic implementation write up- http://www.silverlighttoys.com/Tutorials.aspx?tutorial=1
Detailed write-up - http://stuff.seans.com/2010/05/07/silverlight-4-project-types-part-ii-%E2%80%93-silverlight-navigation-application/

Thursday, October 7, 2010

JQuery Resources

With the recent uptick in JQuery as a go to client side technology, I wanted to share these resources I recently found.

This is a nice article describing the role of JQuery and ASP.NET as well as some well-founded conjecture on the future of Microsoft support of JQuery.
http://visitmix.com/Articles/Javascript-Libraries-and-ASPNET

This is an online training guide, I’ve only skimmed the content but it looks like a fantastic resource.
http://jqfundamentals.com/book/book.html

Wednesday, October 6, 2010

Accessing the UI thread in Silverlight

I’m creating a separate class where I want to move all related Client Object Model (COM) code.

In my case for the COM code to work it must update the UI thread. To accomplish this I had to move the reference from the main page, which was apparently passing through the Deployment object, to explicitly calling the Deployment object.

So in the case of the main page or I suspect any xmal pages code behind use this line of code in the ClientRequestSucceededEventHandler method:

this.Dispatcher.BeginInvoke(updateUI);


For separate classes to gain access to the UI thread use this line of code in the ClientRequestSucceededEventHandler method:

Deployment.Current.Dispatcher.BeginInvoke(updateUI);



Reference:
http://www.go4answers.com/Example/error-invalid-cross-thread-access-48335.aspx
Using Silverlight Object Model: http://msdn.microsoft.com/en-us/library/ee538971.aspx

Tuesday, September 28, 2010

Silverlight Export to Excel

The latest thing I’ve been working on is exporting to Excel from my Silverlight Indicator.

With Silverlight 4 there are two problem domains, In Browser and Out of Browser.

The Out of Browser mode is dead easy using Automation Factory. For it to function it does require the Silverlight App to be locally installed with elevated permissions. There are several examples out there, on the web, of this type of implementation now I leveraged the approach posted by Pradeep at c-sharecorner.com for my application, see his code below. This is a great solution that opens the exported data in an excel spreadsheet.


Solution using Out of Browser Mode
Add reference to Microsoft.CSharp.dll to the project.


using System.Runtime.InteropServices.Automation;


///
///This code has been leveraged from the following site:
///http://www.c-sharpcorner.com/UploadFile/pchandraker/1899/
///
///

private void btnExport_Click(object sender, RoutedEventArgs e)
{
dynamic excelApp;
excelApp = AutomationFactory.CreateObject("Excel.Application");
excelApp.Visible = true;
dynamic workbook = excelApp.workbooks;
workbook.Add();
dynamic sheet = excelApp.ActiveSheet;
dynamic cell = null;
int index = 1;
foreach (Employee emp in EmployeeGrid.ItemsSource)
{
cell = sheet.Cells[index, 1];
cell.Value = emp.EmployeeName;
cell = sheet.Cells[index, 2];
cell.Value = emp.EmployeeId;
cell = sheet.Cells[index, 3];
cell.Value = emp.Department;
index++;
}
}

Reference links –
Automation API - http://msdn.microsoft.com/en-us/library/ff457794(v=VS.95).aspx
More documentation - http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.automation.automationfactory(VS.95).aspx
A slightly different implementation - http://www.codeproject.com/KB/silverlight/SL4InteropWithExcel.aspx
A similar implementation - http://deepumi.wordpress.com/2010/06/01/export-datagrid-to-excel-in-silverlight-4-0/

Solution using In Browser Mode

With the Out of Browser Domain covered, I needed to tackle the In Browser Domain. To my surprise there wasn’t as many solutions as I thought there would be out there. Exporting a datagrid to excel would seem like a common enough task. Though I did find one gem in the rough Raelango on codeproject.com had posted a nice solution that works great if the columns are TextColumns or are TextBlocks in a template column. It defiantly got me pointed in the right direction. You can see his solution here: http://www.codeproject.com/KB/silverlight/SilverlightDataGridExport.aspx

I took a similar approach though I ended up customizing the code to fit my customized data types. It led to a nice solution which saves to an XML or CSV file based on the user choice through a standard save dialog.

Thursday, September 23, 2010

Libraries for Client Object Model

Ok this falls in to information I’ve had to look-up a couple times now. So I’m posting this to my blog for quick reference in the future.

Libraries required for SharePoint development using Client Object Model

The two files for Silverlight are:
Microsoft.SharePoint.Client.Silverlight.dll
Microsoft.SharePoint.Client.Silverlight.Runtime.dll

They can be located on the server at %ProgramFiles%\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ClientBin

For sandbox solutions you need:
Microsoft.SharePoint.Client.dll
Microsoft.SharePoint.Client.Runtime.dll

These are located on the server at %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\ISAPI

Getting the URL Parameter Using C#

As I’ve been working with the SharePoint COM API in Silverlight more things that were really hard to do or nearly impossible to do with SharePoint Designer (SPD) have become easier. One of the first things I need to do was link the Silverlight applications and my existing pages together which I felt was really easy to do by passing Query String Parameters.

This is really easy to do in C# with the Windows.Browser namespace.

Here is the method I use to accomplish this.

private string getURLParam(string key)
{
string value = "";
HtmlPage.Document.QueryString.TryGetValue(key, out value);
return value;
}

Now I can provide whatever key I would like to consume, in my case a row ID so I know which record to query in the SharePoint list.

Saturday, September 18, 2010

Alien Earth Review

Alien Earth by Megan Lindholm

Overall Grade C

This book takes place in a dystopian future long after the earth had been abandoned due to humans killing the planet. Humans are assisted in leaving the planet by the Arthropiana who travel in Beastships which are capable of interstellar travel.

The story is centered on a human crew of the Beastships who are traveling back to earth and the interaction with the Arthropiana co-captain.

Unfortunately the story seemed fairly predictable from plot to the characters, though the character development was paced ok. The one thing I liked, even though I knew how it was going to end by about halfway through, was the ending I felt it really delivered though getting there took a very predictable path.

http://www.meganlindholm.com/novels/alien-earth/

Friday, August 6, 2010

Setting-up SP2010 Dev. Environment (Win 7)

For those that are interested in developing for the SharePoint 2010 Environment to either build a sandbox or standalone solutions here is a quick summary of how to get the development environment set-up for Win7.

Please note that this is a multi-hour process of install / patch / install ... but it is worth it being able to dev for the SharePoint Environment.

• Excerpt from Directions here:
  – http://msdn.microsoft.com/en-us/library/ee554869(office.14).aspx
• Pre-install
  – WCF Hotfix for Microsoft Windows
   • http://go.microsoft.com/fwlink/?LinkID=166231
  – ADO.NET Data Services Update for .NET Framework 3.5 SP1 for Windows 7 and Windows Server 2008 R2
   • http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=3e102d74-37bf-4c1e-9da6-5175644fe22d
  – Microsoft Office 2010 Filter Packs
   • http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=5cd4dcd7-d3e6-4970-875e-aba93459fbee
• Install SharePoint Server (iso can be downloaded from MSDN)
  – Note: The configuration file for the instalation has to be altered. (See full directions)
• Install SharePoint SDK:
  – http://www.microsoft.com/downloads/details.aspx?FamilyID=f0c9daf3-4c54-45ed-9bde-7b4d83a8f26f&displaylang=en

If you already have VS2010 installed no other action needs to be taken. If you don't then you will need to install VS2010.

Thursday, July 29, 2010

Large List in SP2010

This is a long post on a problem with SharePoint 2010 that I worked on over the last week. Centered around understand and working with Large Lists in custom forms. You can skip to the bottom to see the summary of the solution I took.

The Problem:
The Original Error: This view cannot be displayed because it exceeds the list view threshold (5000 items) enforced by the administrator.

This single error led me on quite the educational trip. My first reaction crap my web application is broken. Then I mailed the server administrator asking that the limit be increased, complaining how my solution worked in MOSS. :) Luckily I was barely over the 5K limit so deleting some records let me drop below the 5K limit but I had problem with the application and I needed a way to test it while allowing my customers access to their data.

This led to my first workaround:
- Set the selectcommand to “<View></View>”,
- Edit the asp:Parameter MaximumRows and set it to 5K.
- Then apply xslt filtering.
Wince like I did, but it allowed me to work on the site w/o further disrupting my customers activities. There a lot of reason this is a no-no, performance being the biggest one.

Now I could work, experiment, test on the site / list. The server administrators got back to me after I had found this work around and asked me to continue pursuing a solution as MS would one day come back and tell us to set the threshold setting back to default thus putting us right back to square one. I’ll get back to why the administration team did the right thing here. Even though it seems like the simple answer to increase the threshold, DO NOT DO IT! Many thanks to the administration team for keeping me focused on delivering the right solution.

Before I get to that let me explain to those that may be yelling at the screen why didn’t you have a test site and unfortunately my site / application is very dependent on work flows and I have yet to find a good way to migrate those from site to site.

So back to the education, well we were early adopters and I missed the information about large lists and list throttling. Saw the information that the list can contain about 50 mil records, awesome!!...Missed the point about only being able to work with 5K at a time, though I never intended to even work with that large of a number of records.

Root causing the Issue:
Now I had to start scoping the problem I knew two things once a list crosses 5K records it now becomes a large list. What worked on a regular list no longer seems to work on a large list and I can only work with 5K records at a time and my exiting filters were not working before the records were being pulled.

So I needed to understand what a large list was:
- Which led me to this page: http://msdn.microsoft.com/en-us/library/ff798465.aspx
-- The best resource I found was a paper MS wrote about large lists titled “Designing Large Lists Maximizing List Performance” and can be downloaded here: http://www.microsoft.com/downloads/details.aspx?FamilyID=fd1eac86-ad47-4865-9378-80040d08ac55&displaylang=en
--- I was a bit shocked when the doc called out that most users when first faced with this problem are tempted to increase the threshold and it explained why not to take that approach in technical details. (it’s not every day that you can point at a doc and say I behaved exactly that way :) )
-- The second best resource was the help doc (I believe this is a replication of their online help documentation)- http://sharepoint.microsoft.com/blogs/GetThePoint/Lists/Posts/Post.aspx?ID=303

Unfortunately these papers didn’t really deal with my problem exactly. Though it begun to point me in the right direction and to be aware of some of the side effects of the list being a large list and explain what I was experiencing.

Some side effects or symptoms that a list has passed the large list threshold and become a large list or at least what I have experienced:
• Filters that worked previously no longer work
• Sort and filter functionality no longer works
• Some views may not work
• Count on list views will not work

Possible Permanent Solutions:
I first tried a query filtered with an indexed column, according to the documentation this is supposed to be the Holy Grail fix. Unfortunately this did not work as expected and still got the threshold error. So I abandoned this approach, I’ve head numerous issues with DFWP since I migrated to 2010 I figured this was one more thing that was neglected by MS and I’d have to file another bug against 2010.

I next compiled a list of potential workaround with a help of my site / application architect.

- Content iterator
-- http://msdn.microsoft.com/en-us/library/ff798376.aspx
-- Code solution
- Partitioned View
-- http://msdn.microsoft.com/en-us/library/ff798344.aspx
-- Seems to only apply to SQL data sources
- Managed Metadata
-- Will require adjustment to the list
-- Should have been applied at design phase
-- Will require a lot of pre-work in planning before implementing
- Content Query Web Part
-- To enable it
--- http://vspug.com/ssa/2010/02/06/sp2010-tip-content-query-web-part-missing-in-sharepoint-2010/
--- http://social.msdn.microsoft.com/Forums/en/sharepoint2010general/thread/4cfcdb20-0e1e-4651-bfda-008fe554696e
-- To Use it
--- Dated write up - http://blogs.msdn.com/b/ecm/archive/2006/10/25/configuring-and-customizing-the-content-query-web-part.aspx
--- Newer info - http://blogs.msdn.com/b/ecm/archive/2010/05/14/what-s-new-with-the-content-query-web-part.aspx
-- Customize it
--- http://msdn.microsoft.com/en-us/library/aa981241.aspx
--- http://msdn.microsoft.com/en-us/library/ms497457.aspx
- Access Services
-- Dead end
- Re-architect the site using folders and custom content types
-- This would enable easier filtering that would not hit the threshold
-- Similar implementation to Managed Metadata
-Bring in MS SharePoint consultant to solve our problems
-- This was added for completeness… :)

The Final Solution:
While we are eventually going to go to a coded solution hosted in our sites Sandbox we are not there yet. So I focused on the lowest code solutions. I started working with the CWWP (Content Query Web Part). It was the first time I have used it I can see how it can be very useful for someone who didn’t want to edit the XSLT directly. Though it does require some knowledge in how the list is structured. Then I read that the CQWP is an extended DFWP and it was working so it led me back to my CAML Query. I remembered a line in one of the documents that it said when filtering a query for a large list always use an AND operator as an OR will rarely limit the results below the threshold. I knew my CAML Query didn’t have any operators so I just gave it a try using a static true statement with my filter on an indexed column so that I would get an AND operator in the select command.

The static statement is also using an Indexed column (ID) and it is simply comparing to see if it is greater than zero (which is always True).

The CAML Query that works:

selectcommand=
"<View>
 <Query>
  <Where>
   <And>
    <Eq>
     <FieldRef Name="PN_ID"/>
     <Value Type="Text">
      {PN_ID}
     </Value>
    </Eq>
    <Gt>
     <FieldRef Name="ID"/>
     <Value Type="Counter">
      0
     </Value>
    </Gt>
   </And>
  </Where>
 </Query>
</View>"

The CAML Query that did not work (Even though it is using an Indexed Column):
selectcommand=
"<View>
 <Query>
  <Where>
   <Eq>
    <FieldRef Name="PN_ID"/>
    <Value Type="Text">
     {PN_ID}
    </Value>
   </Eq>
  </Where>
 </Query>
</View>"


Summary:
For large lists, do your best to plan ahead.
Try to determine which potential solution is the right one for your audience.
See the “Designing Large Lists Maximizing List Performance” document
If the right solution is to use the DFWP then make sure that you:

  • Have at least 1 indexed column you can filter on effectively
  • Index Before your list is over the threshold preferably
  • Use two filter criteria’s on Indexed Columns to ensure that you have an AND operator in your CAML Query.

Tuesday, July 20, 2010

Linked Data Ssource Limitation SP2010

Interesting SharePoint 2010 limitation, when using linked data sources ensure that your page does not display over 225 cells per page.

What I mean by Cells is the calculated value of rows by columns.

Unfortunately for whatever reason MOSS (SharePoint 2007) had the capability of going higher than 225 cells without failing but they did not keep the same capability in 2010.

The primary symptom of the error besides the Data View Web Part not rendering is that you end up with a StackOverflowException in the logs. Search the correlation ID you receive in the error in the logs and you will find the corresponding error.

Reducing the page size or displayed columns is really the only non-code fix and is the short term solution I was forced to implement.

The MS rep I discussed this with said the defect is due to the SharePoint Designer render, and recommended a long term solution which will be to implement the page in the sandbox environment using custom built pages with the client object model. He indicated MS may eventually fix the issue.


Bug characterization Information
  • Removing the second template call replaced with spaces did not lead to an error.
    This means I still had 375 cells but only 125 contained data from a list the other 250 were just html spaces.
  • Tried encapsulating the template call in a variable to see if it would force better memory optimization, this did not change anything.
  • This issue seems to only effect joined lists as I have a single list in a Data Form Web Part that is displaying 5 columns by about ~200 rows
  • Always fails at 375 cells

Wednesday, June 30, 2010

Using the Row ID value in a calculated column

Row ID cannot be referenced directly in a calculated column. Well that’s not exactly true. You can do it once and the values will stay after the calculated column has been defined, meaning you just put [ID] in the field. But once an Item is added to the list or a record is edited it will no longer have the right reference in the field, it loses the brackets around ID.

Summary of MS reference doc on this issue:
http://office.microsoft.com/en-us/windows-sharepoint-services-help/introduction-to-data-calculations-HA010121588.aspx
- You cannot reference the ID of a row for a newly inserted row. The ID does not yet exist when the calculation is performed.
- You cannot reference another column in a formula that creates a default value for a column.
- This is also valid for other system columns like [Version] or [Modified].
- Applies to SharePoint 2007 and 2010

There are two ways to address the problem.

Short term / non-permanent: The calculated filed can be reset after any adds or edits by adding the brackets around the ID reference, so ID will look like [ID] again.

Long term / permanent:
1. Create a number column w/ 0 deciaml places (Via web portal)
     a. I usually call it LookupID
     b. Create a calculated column that references the LookupID column (E.g. =[LookupID])
          i. Or replace the reference of ID with LookupID for an existing calculated column
2. For lists with existing records
     a. Create a special data sheet view that has ID and LookupID in it. (Via web portal)
     b. Copy ID value to LookupID
3. Now Create a workflow that populates the LookupID column with the actual row ID for new records (Via SharePoint designer)
     a. Set the step action to be “Set Field in current Item”
     b. Select LookupID as the Field
     c. For Value use define workflow value button
          i. Leave Current Item as DataSource
          ii. Select ID as Field from Source
     d. Set LookupID to CurrentItem:ID

Thursday, June 17, 2010

Hiding and Unhiding Lists and Libraries in SP2010

In SharePoint designer you gain the ability to hide lists. This provides some obscurity capability in that unless the users know list name they most likely won’t be able to find the list. This does not mean that the lists are secure, security by obscurity has been proven to fail every time.

How to hide a list:
First Hiding only takes 2 button clicks.

Using SharePoint Designer open the property page of the List and in the settings area check “Hide from browser” then save.

The list will now be hidden.
Though this does not prevent direct linking to the list if for example the user knows the name of the list or has a URL to it. This can be leveraged by having direct links that one can use to access the list directly after the list is hidden.

Working with Hidden lists
Once a list is hidden it is hidden from not only the browser it is also hidden from SharePoint designer.
Note I personally think that having the list hidden from SharePoint designer is a bug and have filled a report with Microsoft.

If you need to work with it and you do not have the information to work with the list saved elsewhere (Meaning the list Query information) you will need to unhide it.

Unhiding a list
1. Using SharePoint Designer
2. Select All Files in the Site Objects area in Navigation
3. Select List folder
4. *Important* Right Click to bring up the context menu (Left clicking will bring up the list views)
5. Select Properties from the Context menu
6. Deselect Hide from browser
7. Save Changes (The List will now be viewable via all site content in the browser and in the List and Libraries Site Object in SharePoint Designer)

Thursday, May 27, 2010

Posting code in Blogger

Ok Blogger gets a big Fail for support of writing and sharing code via a blog. Luckily there seems to be a solution, a text area tag.

I first found a solution over at dreamincode.net - http://www.dreamincode.net/forums/topic/61131-code-in-bloggercom-posts/
Though this one had formatting issues.

Then I came across this entry which talks a bout a code tag and was much happier with the formatting that I was able to do.
http://jayaprakashkv.blogspot.com/2007/12/how-to-add-html-code-in-blogger-post.html


It links to this very nifty tool here - http://www.simplebits.com/cgi-bin/simplecode.pl



Though that tool was not the final solution I actually had to go back in and add the nbsp operator to get indenting to look right but I had the right look finally.

Wednesday, May 26, 2010

jQuery UI (Tabs) on SharePoint

There have been several articles written about using jQuery on SharePoint.

This article focuses specifically on implementing jQuery UI Tabs in a SharePoint Master Page using SharePoint Designer.

So what exactly is jQuery UI Tabs, it is a JavaScript that formats div panels to function as a tab control. See the demo page here for the script in action: http://jqueryui.com/demos/tabs/

Walkthrough

Requirements
A master page with a Content Place Holder in the header and another one in the body tag.
Most master pages will have this by default.
The jQuery UI libraries - http://jqueryui.com/
I recommend on just downloading the default Theme and with all of the UI features selected to start with. You can always down load a different theme latter once the functionality is working as expected.

You will also need the cookie library if you are going to use that functionality - http://plugins.jquery.com/project/cookie
This example includes the use of the cookie Library.


Instructions
1. Create a new page from master
2. Add the libraries to the head tag

In my master page the content place holder is called PlaceHolderAdditionalPageHead so I needed to locate that in the code view of my page.

Then I add the references to the theme, the main jQuery library, the jQuery UI library, and the cookie library.

So my place holder now looks like this

<asp:Content id="Content1" runat="server" contentplaceholderid="PlaceHolderAdditionalPageHead">
  <link type="text/css" href="css/cupertino/jquery-ui-1.8rc1.custom.css" rel="Stylesheet" />
  <script type="text/javascript" SRC="scripts/jquery-1.4.2.min.js" ></ script >
  <script type="text/javascript" src="scripts/jquery-ui-1.8rc3.custom.min.js"></script>
  <script type="text/javascript" src="scripts/jquery_cookie.js"></script>
</asp:Content>


3. Add the script that to change how the div panels render

<!--init tabs-->
<!--Tab selection expires in one day (24hrs)-->
<script type="text/javascript">
  $(document).ready(function() {
  $("#tabContainer ").tabs({ cookie: { expires: 1 } });
 });
</script>


4. Last add the div panels which will hold the content
a. The li tags will be your tab headers
b. The corresponding div panels will hold your tab content

<div id=tabContainer style="width: 100%">
  <ul>
  <li><a href="#tab-1">tab1</a></li>
  <li><a href="#tab-2">tab2</a></li>
  <li><a href="#tab-3">tab3</a></li>
  <li><a href="#tab-4">tab4</a></li>
  <li><a href="#tab-5">tab5</a></li>
  </ul>
 <div id=tab-1 style="width: 100%">Insert tab1 content here</div>
 <div id=tab-2 style="width: 100%">Insert tab2 content here </div>
 <div id=tab-3 style="width: 100%">Insert tab3 content here </div>
 <div id=tab-4 style="width: 100%">Insert tab4 content here </div>
 <div id=tab-5 style="width: 100%">Insert tab5 content here </div>
</div>


Wrap-up
The great thing about this is it works in both SharePoint 2007 and 2010 and its completely rendered client side. Now for those that run w/ JavaScript disabled it degrades gracefully as well, stacking the div panel on top of each other.

There are no restrictions on the div panel content; it can be anything that is allowed in a standard div, Data View Web Parts to strait HTML for example.

Happy Tabbing! :)

Wednesday, May 5, 2010

SharePoint 2010 - Redirecting a form

In MOSS the most efficient and reliable method of redirecting a form was to use a query string parameter. This is where you have the page url followed by a parameter. Site.com\page.aspx?source=targetURL for example.

In 2010 Microsoft has made a vast improvement where specifying the redirect URL in the custom form actually works. What is great about this is it allows for a page to go to two different locations based off wither the user hits save or cancel.

To implement find the onclick command for the button whose behavior you would like to change. It should be calling a GenFireServerEvent in the ddwrt namespace. Append ‘;__redirect={targetURL}’ following the commit or cancel filed. The field should now look like this
__commit;__redirect={ targetURL }

Save the page and you have a fully functioning redirect hidden from the users.

Many thanks to IOTAP for the pointer - http://web.iotap.com/Blogs/tabid/277/EntryId/7/Redirecting-to-a-custom-URL-from-Sharepoint-custom-forms.aspx

Saturday, April 24, 2010

Web Site Performance improvements

I updated the site so that it performs better by adjusting the caching behavior and limiting the number of blog articles I pull for the front page.

Thursday, April 22, 2010

I made the Showcase!!

My Cryptogram Game - Caesar Cipher made the Silverlight Showcase.
Here is a link to the Showcase: http://www.silverlight.net/showcase/

Saturday, April 10, 2010

Cryptogram Game Updated

My Silverlight Game has been updated it now has a timer that records the best time when a cipher is beaten and when the cipher reloads it shows the best time.

Friday, April 9, 2010

Blogger Example

So I have a new example up where I demonstrate how I am consuming the Google Blogger feed and a simple JQuery tab control. Check it out Here

Silverlight Security

A friend at work refered me to this article by Nick Kramer on Silverlight security.

For general security considerations for Silverlight there is no better single source avilable currently. Silverlight really demonstrates how secure a software product can be if it follows a Secure development life cycle process.

Link to the blog post which contains the document and a short into to it from Nick.
http://blogs.msdn.com/nickkramer/archive/2010/03/19/updated-security-overview-for-silverlight-4-rc.aspx

Thursday, April 8, 2010

Selecting a Unique value in a DFWP dropdown menu + passing it as a Query Param

To create a drop down menu with unique list values you must use xslt filtering on the row selection.



Idea applied from here - http://social.msdn.microsoft.com/forums/en-US/sharepointcustomization/thread/9b2464fc-1255-431e-8976-f4c9e44ec256/
Source quoted in that post here - http://blogs.msdn.com/timpash/archive/2005/11/23/XPATH-Filtering-Distinct-Values.aspx


Now that unique values are assured and we have nice drop down values. A change or selection listener has to be created.

I used the following resources to learn how to do this. Key take away the value has to be set for the selection. For what every reason Microsoft chose not to set it.

5 out of 5 - http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/584a94dc-9f44-4dee-8e95-7d47fe8fcee5
Related in depth explanation 6 of 5 J - http://mdasblog.wordpress.com/2008/01/03/firing-an-event-when-a-user-selects-a-value-from-a-data-view-web-part-dropdown/
Another resource I reviewed: http://social.msdn.microsoft.com/Forums/en/sharepointcustomization/thread/b75dcf23-a5de-4f1a-ba70-fccf44989bd7

Don’t forget to check if your user has made a selection. :)

Now that the change listener has been added a parameter can be added to manipulate another DFWP as desired.


Another good link - http://blogs.msdn.com/frontpoint/archive/2005/02/08/369249.aspx

Bloger Functionality is Live

Very Excited Blogger functionality is live. The Front page is now pulling from Google Blogger through the Atom feed. I have a backlog of posts that will be filling in content in various parts of the site. Through out the rest of the week.

Saturday, April 3, 2010

Master Page Updated

Finished the update to the master page so now the Ceaser Cipher is now wraped with the master page. Check it out Here
I have a couple more updates to the game coming with an addition of a timer.

Thursday, April 1, 2010

Caesar Cipher

My first Silverlight Application, Caesar Cipher, is now complete check it out in the Silverlight Section, Or Direct link to it Here.
I did find that I will need to update my master page to accommodate this app due to layout constraints, so it is hosted in htm page for now. Updating my masterpage will be my next task.