Dave's Technophorical Times

A blog about Microsoft's Technologies!
SharePoint :: MVC :: ASP.NET :: IIS :: SQL Server :: Visual Studio :: MS Access

When attempting to Sort by different "MULTIPLE" Columns using a SQL Server Stored Procedure, this is the how it is done! 

USE AdventureWorks; 
SELECT   ContactID, 
         FirstName, 
         LastName, 
         Title = COALESCE(Title,'')
FROM     Person.Contact
WHERE    LEFT(FirstName,1) = 'M'
ORDER BY CASE 
           WHEN LEFT(LastName,1) = 'A' THEN RANK() OVER(ORDER BY FirstName + LastName) 
           WHEN LEFT(LastName,1) = 'M' THEN RANK() OVER(ORDER BY LastName + ', ' + FirstName, Title) 
           WHEN LEFT(LastName,1) = 'U' THEN RANK() OVER(ORDER BY LastName + ', ' + FirstName DESC) 
           ELSE                             RANK() OVER(ORDER BY LastName DESC, FirstName DESC) 
         END 

Another example: This is passing in the Sort order via a Stored Procedure Parameter. In this case @SortOrder is a varchar(100).

SELECT ItemId, ProdSize, TagNoProductIdLocation, PONo
FROM vewInvTrxSummary
ORDER BY 
        CASE WHEN @SortOrder LIKE '%Product, Tag, Location, Size, PO%' 
THEN RANK() OVER(ORDER BY Prod, TagNo, Location, Size, PONo)
                  WHEN @SortOrder LIKE '%Product, Size, Tag, Location, PO%' 
THEN RANK() OVER(ORDER BY Prod, Size, TagNo, Location, PONo)
                  WHEN @SortOrder LIKE '%Size, Product, Tag, Location, PO%' 
THEN RANK() OVER(ORDER BY Size, Prod, TagNo, Location, PONo)
                  WHEN @SortOrder LIKE '%Product, PO, Tag%'                      
THEN RANK() OVER(ORDER BY Prod, PONo, TagNo)
                    ELSE RANK() OVER(ORDER BY Prod, TagNo, Location, Size, PONo
         END


I had an issue of Web Sites NOT rendering in IE9 for a site that I have running locally in IIS. I could, however, render the page in IE9 on another machine and it worked just fine. My issue was just locally and ONLY when I used the local machine name. i.e. http://localhost WORKED! But http://MachineName DID NOT work. So to fix my issue I just addedhttp://MachineName to the Local Intranet Site list in IE9.

Tools -> Internet Options -> Security -> Local Intranet -> Sites. Then Addhttp://MachineName to the list. Uncheck the https checkbox if just adding http.

Then it all started working locally. I'm not sure why this is as I have other servers that work just fine. I have never come across this issue until now. Good news is that it works now, but I would like someone to explain why I had to do that in the first place.

BTW, this was on a Windows 2008 R2 after installing SQL Server 2012 Reporting Services and SharePoint 2010 Enterprise.

Hope this helps someone!

Dave.



I had this same issue and the reason why it multiplies is because it's in a Content Editor WebPart (CEWP) as a <Script> when it should be Linked to a document in a library. Basically, copy the <Script> into a Notepad document then save it as Widget.htm on your desktop. Then create a New Document Library called Widgets (sounds good to me!), then add the Widget.htm file to the library. Click in the document and you will see the widget render as expected. Then the copy the URL from the address bar. Add a new CEWP to your web page and then paste the URL into the link section! BTW, I would not include http://mysite in the link, just use everything else it.

Now your widget is safely rendered and it will NOT multiply like magic bunnies.

Hope this helps someone out there! Oh BTW, this issue arrived to me after I migrated a 2007 to 2010 site.

Dave



I have had to do some work on Data List Views recently after migrating from 2007 to 2010 since DataFormWebParts don't really work as they should in 2010, especially when it comes to the DispForm.aspx, for example, especially because (at least I found this) it would not open the DispForm.aspx page in Modal Dialog mode. Plus the New and Edit forms would not open in Modal Dialog either. So I have found a few excellent videos by Laura Rogers that helped me a lot. Basically XSLT Views Rock!

Laura Rogers - SharePoint 2010 Data View and XSLT List View:  http://www.youtube.com/watch?v=r2eODYHp73A

Laura Rogers - Creating Hyperlinks in SharePoint Designer 2010:  http://www.youtube.com/watch?v=-ZBF_J1RWis

SharePoint 2010 - Display list or library on another site:    http://www.youtube.com/watch?v=0SfpgoEUlIw

YouTube Site: http://www.youtube.com/user/WonderLaura67

Laura provides a lot of information so please replay the videos as you will pick up more and more as you put her advise to practice.

Hope this helps someone out there! I know it helped me a great deal.

Dave 



I have had this issue popup a couple times in the last 2 years and it always catches me off guard!

You notice that "all of a sudden" one day that your SharePoint Site is Locked. You can't add anything, change anything, like users or documents. It's all locked! This is usually because a Backup was stopped (or died from a server reboot!) before it was able to complete!

Simple solution that you can run at the SharePoint PowerShell Command Line: Set-SPSite -Identity "<SiteCollection>" -LockState Unlock
More Info here: http://technet.microsoft.com/en-us/library/cc263238.aspx 



After a upgrading SharePoint 2007 to 2010, the UI Version is still set to version 3, which makes it look like SharePoint 2007. In order to update the UI to look and feel like SharePoint 2010 to need to run the following script, which will update all site collections. You should save this as UpdateSPUIVersion.ps1, then run it in PowerShell.

Add-PSSnapin Microsoft.SharePoint.Powershell –ErrorAction SilentlyContinue
$SiteCollection=Get-SPSite("http://<SharePointSiteURL>")
foreach($web in $SiteCollection.AllWebs)
{ 
    $web.UIVersion = 4; 
    $web.UIVersionConfigurationEnabled = $false; 
    $web.update();
}

 



For SQL 2005, delete the file:

C:\Documents and Settings\<USER>\Application Data\Microsoft\Microsoft SQL Server\90\Tools\Shell\mru.dat

For SQL 2008, the file location, format and name changed:

C:\Documents and Settings\<USER>\Application Data\Microsoft\Microsoft SQL Server\100\Tools\Shell\SqlStudio.bin

How to clear the list:

  • Shut down all instances of SSMS
  • Delete/Rename the file
  • Open SSMS


The quick way to get a Quick Launch to open in a new windows is like this! The Gotcha is NOT to use double quotes! Always use single quotes.

javascript:window.open('http://www.bbc.co.uk','_blank');history.go(0);
Good link here too: http://techtrainingnotes.blogspot.ca/2010/10/sharepoint-javascript-in-quick-launch.html

To Open a SharePoint 2010 window as a Dialog such as NewForm.aspx, use this method.

EXAMPLE CODE:
JavaScript:var options=SP.UI.$create_DialogOptions();
options.url='http://techtrainingnotes.blogspot.com';
options.height = 400;
void(SP.UI.ModalDialog.showModalDialog(options))

Put this in one line in the Quick Launch, like this;

JavaScript:var options=SP.UI.$create_DialogOptions();options.url='/intranet/Lists/Issues/NewForm.aspx';void(SP.UI.ModalDialog.showModalDialog(options))


as explained here: http://techtrainingnotes.blogspot.ca/2010/12/sharepoint-opening-2010-dialog-box-from.html

 



Laura Rogers has posted it here!

https://www.nothingbutsharepoint.com/sites/eusp/Pages/data-view-web-part-the-basics-add-a-hyperlink.aspx



Simply go into the "Modify View" for the list and select/de-select the Tabular View checkbox. 



The Blogger

Dave Stuart I'm a Developer with a passion for coding. I enjoy the challengers that come with the job! SharePoint is one of my expert areas along with .NET Web Development with MVC and good old MS Access VBA coding. I Blog so that I can remember how I did that way back when; PLUS all this stuff is searchable! I constantly study and run my own business, Dafran Inc. I have passed 22 Microsoft Exams since 1998 when I first jumped on the treadmill of knowledge. I hope that you enjoy this Blog as much as I enjoy updating it. All the very best from Calgary, Alberta, Canada. contact me at linkedin @ dafran.ca

Calendar

<<  June 2019  >>
MoTuWeThFrSaSu
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

View posts in large calendar

Sign in