Monday, December 17, 2012

NameValueCollection In C#.NET

Introduction: In this article we will see what is NameValueCollection  class provided by .NET and when to use this class.

Description:

1.       It’s a data structure that store data in Key(String) and Value(string) format.
2.       It allows user to store multiple(duplicate) values for the same Key.
3.       You can access data either via Key or via index.
4.       It’s very similar to HashTable that also allow you to store data in Key and Value format.
5.       When you add a value in the NameValueCollection , Its size grows automatically by relocation.
6.       This class is situated in System.Collections.Specialized namespace.
7.       Its performance is very poor than any other data structure like List, Dictionary or Hash Table so you must be very careful while choosing this data structure unless you tested it for performance.

Saturday, December 15, 2012

Display Image Gallery Using Repeater In ASP.NET

Introduction:  In this article we will learn how to create a image gallery using repeater control in asp.net. Follow simple steps for this ..

Procedure:

1. Drag and Drop a repeater from toolbar in your asp.net web page.

2. Design the layout in the <Item Template></Item Template> section as per requirement or simply paste  this code.

<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<h2>
Product Category List</h2>

Swap Value In A Table Column

Introduction:  In This article we will see how to interchange the values of  a column in a table. Sometimes in our development cycle we may have to face a situation where we might have to interchange the values of a table column. SQL has provided us a very useful query for this purpose.

Example:  Suppose you have a Product table as below. And you have to swap the active field values i.e. True must be False and False must be True.