Rounded Corners on Web Parts

The Holy Grail of SharePoint branding - at least as far as I’m concerned – is rounded corners on Web Parts. Every design that comes in has this at first. As mentioned yesterday there are examples of doing this for the web part’s title - I’ve done this using Madalina’s instructions and Heather Solomon has some instructions too.

However, as far as I know nobody has yet figured out a way of putting rounded corners on the bottom corners of web parts. The HTML they have does not suit them to do this via CSS. The only idea I’ve had previously was to use ControlAdapters to modify the output of of the Web Part itself. And I’m pretty sure you’d have to write an adapter per web parts. That kind of sucks; no customer is going to be in a hurry to pay for that.

Well, when I was looking at putting borders around an entire web part zone, I had a thought. What we really need to do is insert elements into our page. jQuery can do that sort of thing. Could I use jQuery to find each web part and wrap some tags around it? Read more »

Rounded Corners on Web Part Zones

Curiously, one of my more popular blog posts is about putting rounded corners on things in SharePoint. It does seem that this is a pretty popular question. As a side note, Heather Solomon has a post about doing this for web part titles, though I followed Madalina’s instructions.

Anyway, one design requirement that come up repeatedly is rounded borders on Web Parts. I swear, it comes up with every design – and it isn’t possible (although I have an idea – more on that tomorrow). What you can do, though, is have a rounded border about the entire web part zone… Read more »

Automatically add themes to the SPThemes.xml file

I’m not sure I’ll use themes again over the AlternateCssUrl again in a hurry, but I did decide to take a look at the 10 example themes Microsoft Released in March. I’ll blog about how they look – sometime! (The short answer – some good, some bad, some awful!)

Anyway, I was interested that the themes could all be activated as features. This rather kept with my feeling on how branding should be deployed.

However, some of the themes (though not all) were suddenly available in the ‘Site Themes’ page of my SharePoint system. I knew from experience that this isn’t something that ‘just happens’ – previously, I’ve done it by hand.

EDIT: See the comments – they describe an possible pit fall, but both have articles about how to do the same thing… Read more »

Be selective about how you get items from an SPList

Just read an interesting article from Waldek Mastykarz called ‘Performance of various methods to retrieve one list item’. It’s well worth a look – go and read it.

So, the interesting thing I took away from it was just how slow the GetItemById() method was compared to an SPQuery. Why? Wouldn’t it make sense to use and SPQuery within the GetItemById() method?

Well a bit of Reflector digging (again) shows that it does! But it isn’t just a query for the item with that Id – it also specifies that the

SPQuery.ViewAttributes = "Scope=\"RecursiveAll\" ModerationType=\"Moderator\" ";

Hmm. So it’s probably a more complicated query. Depending on your solution, you might not need “RecursiveAll” – I try to avoid folders in lists, preferring views to break down my content.

So, the lesson that I took away was that if you are doing a LOT of getting items from lists, it is worth considering how you want to. There isn’t a right answer, unfortunately, and testing is key. The problem is, there are many factors:

  • Can you use caching?
  • Do you know the list you’re getting items from?
  • Are you getting items from more than one list?
  • Do you have folders?
  • What other parameters might your query have?

It’s difficult to know, hence I think Waldek is right – give it a test so you have some idea!

Create New Document Web Part

Ages ago I observed that the ‘Add New Document’ link in a summary toolbar takes you to an ‘Upload’ page, rather than creating a new document based on that template, and suggested doing something about that. That was a bit of a hack, though, so now I’ve written a web part to allow you to display ‘Add new…’ links and if you click on them, it opens up a new document based on that content type’s template. I’ve called it the ‘Create New Document Web Part’

CreateNewDocumentWebPart itself

‘Edit Document’ requires a Windows SharePoint Services-compatible application and Microsoft Internet Explorer 6.0 or greater

We test our applications often using ‘RunAs’ to run Internet Explorer under a different session. I know that SharePoint allows you to ‘Log in as a different user’ but it doesn’t always work that well for us (i.e. you log in repeatedly and it might let you in).

One of my colleagues was trying to edit a document logged into Windows as one user, but running his IE session at a different user. Clicking on the document opened it Word in IE – despite that the Library should try and open documents in their client application. Trying to edit the document he got the message:

‘Edit Document’ requires a Windows SharePoint Services-compatible application and Microsoft Internet Explorer 6.0 or greater.

This is the same message as mentioned in KB833714, but a different cause. When I tried editing the same action but as the user he was logged into Windows as it worked fine.

Find the Version and Edition of a SQL instance

I’ve got a lot of Virtual Machines for development, and that means a lot of SQL installs. They’re not all the same edition, though, or versions, or service packs. It can be a bit confusing knowing which one I’m dealing with. And I can never remember how to find out – so here is the reminder…

capture

So:

select serverproperty('productversion'), serverproperty('productlevel'), serverproperty('edition')

Using jQuery to fix the removal of the Title column of a list

SharePoint List items all have a Title column (although it’s display name might be changed to something else). This Title column is a string, which is unfortunate as sometimes you really don’t need a string column on a list; this was the need I faced.

You can make a Title column not required:

turn-off-title-requirement

Also, if you go to the ‘Advanced Settings’ page of your list and ‘Allow management of Content Types’ you can then go into your content types and Hide the Title column. This is okay – but the Title column is still there – it’s just being displayed with “(no title)”… Read more »

Filter User Columns by Account

I needed to query an SPList by a User column. I wanted to query the list by account (DOMAIN\User) and check that that user existed. Essentially, I’m validating the input of a PeopleEditor control against users in the SPList. Unfortunately, this didn’t look possible – examining my list items through the object model I seemed to get back a value like a lookup field – that is [number;#value]. For example:

1#;John Smith

Not very useful – accounts are unique, but John Smith’s aren’t. I was beginning to feel a bit frantic about not being able to do this sort of query when I found this very useful post by Karthikeyan Kasiviswanathan. The short of it – you have to set the column up to display the account if you want to query by the account.

Sort of makes sense – but is a bit weird too. I mean, isn’t the account the unique bit? Shouldn’t I always be able to query by that? Still, this should work for me.

Webpart Titles not shown in WebPartZone…

Curious problem this – I had a web part zone where all web parts being put in it would be displayed without their titles. Didn’t matter if you manually went and turned on the chrome to show a title – that setting never saved, and the web parts didn’t ever have a title.

After tracking through all the page’s code, I found that when I set the WebPartZone’s ID to be ‘Main’ then my web parts ceased functioning correctly; their titles disappeared. If I set the ID back to ‘Left’, then all was fine.

I don’t know why this happens, but certainly using a different ID for my zone fixes it. If anyone knows why this actually happens, please let me know.

Next Page »

 Subscribe in a reader