Tuesday, March 16, 2010

Difference between ArrayList And HashTable And Dictionary

I was always keen to know the difference between ArrayList,HashTable & Dictionary. Here it goes.

An ArrayList behaves just like an array, except that it will dynamically expand and contract when you add/remove elements to it. A HashTable is useful when you want to lookup objects indexed by a 'key' value. It also dynamically expands and contracts but doesn't impose an order on the elements like an array does. Put a different way: you index elements in an ArrayList with a numeric index, you index elements in a HashTable with a key. Such a key is often a string.

A Dictionary is a hash table.Dictionary is a generic type, Hashtable is not. That means you get type safety with Dictionary, because you can't insert any random object into it, and you don't have to cast the values you take out.

Thanks to the following links.

http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/84b8d2a1-e84d-446a-94bb-4ec54d3b38cf

http://stackoverflow.com/questions/301371/why-dictionary-is-preferred-over-hashtable-in-c

Wednesday, March 10, 2010

Displaying Attachments in DataView

Normally attachments don't show up in a DataView webpart in SharePoint Designer. To display the attachments, add the following lines in your DataView.

<SharePoint:AttachmentButton ControlMode="Edit" Enabled="true" ItemId="{@ID}" runat="server" Visible="false"/><SharePoint:AttachmentsField ControlMode="Display" ItemId="{@ID}" EnableViewState="true" FieldName="Attachments" runat="server"/>

Thanks to the following link.
http://dbweb.sbisite.com/blogs/bf/Lists/Posts/Post.aspx?ID=19

Monday, March 8, 2010

Cascaded Dropdown in Sharepoint using jQuery

We had to achieve the functionality of Cascaded Dropdowns in SharePoint 2007 Custom List Form web part without custom code. Thanks to the following link which helped in achieving the same

http://spservices.codeplex.com/wikipage?title=$().SPServices.SPCascadeDropdowns&referringTitle=Documentation

Tuesday, March 2, 2010

Dealing with SharePoint Lookup DropdownList with more than 20 items

This has been nagging for so long. Whenever you have a dropdownlist column pulling values from a lookup list with more than 20 items, SharePoint makes it like an editable dropdown. To get around this issue, I found a couple of excellent links which explain the solution.

http://www.sharepointings.com/sharepoint-lookups-over-20-items-solution/

http://boris.gomiunik.net/2009/10/sharepoint-lookup-field-how-does-it-work-and-how-to-add-javascript-event-handler-function-to-it/