Monday, December 17, 2012
NameValueCollection In C#.NET
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
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
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.
Thursday, December 06, 2012
Tuesday, November 27, 2012
Difference between WCF and Web service
Web service is a part of WCF. WCF offers much more flexibility and portability to develop a service when comparing to web service. Still we are having more advantages over Web service. Following points provides detailed difference between them.
Web Service:
- Hosting -It can be hosted in IIS.
- Programming -[WebService] attribute has to be added to the class.
Features of WCF
Service Orientation
One consequence of using WS standards is that WCF enables you to create service oriented applications. Service-oriented architecture (SOA) is the reliance on Web services to send and receive data. The services have the general advantage of being loosely-coupled instead of hard-coded from one application to another. A loosely-coupled relationship implies that any client created on any platform can connect to any service as long as the essential contracts are met.
Important Sql Queries
Introduction: In this article i am going to give some of very useful SQL Queries that are required to us in our day to day programming life.
1. Get current Database Name: Select DB_NAME()
2. Get Details Of All Databases Present In SQL Server: Select * from sys.databases
3. Rename A Database: Exec sp_renamedb ‘oldDatabaseName’ , ‘newDatabaseName’
Dataset Vs DataReader
| Dataset | DataReader |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Thursday, November 22, 2012
Filter GridView Using tablesorter_filter plugin in ASP.NET
Introduction: Hey guys in the previous article i have explained how we can sort gridview and paginate gridview in asp.net at client side without making any postback to server using very small jQuery plugins for table sorting paging, filter. In this article i am going to explain how we can implement the filtering of records based on any column or group of columns either in a table or girdView. You can download each of these plugins by clicking here.
Wednesday, November 21, 2012
Gridview Paging With TableSorter Pager Plugin
Introduction: In the previous article i have illustrated how we can use table sorter plugin into ASP.NET GridView Control to sort records displayed in gridview at client side without consuming server resources..This article describes the implementation of Pager ad-on of the table sorter plugin with GridView in ASP.NET to display paged records at the client side. So without making any post back you would be able to display desired no of records in gridview. So this would be a great approach if your application is going to contains large chunk/amount of data that need to sort and display at client side.
Tuesday, November 20, 2012
Sort GridView Using Table Sorter At Client Side
Introduction:
First of all i would like to introduce you with the table sorter. It's an add-on that uses jQuery plugin to sort the table at client. Since we are sorting table at client side so no server resources is being consumed and no post back occurs and no load on server side for sorting the table. you can download this plugin from the following website www.tablesorter.com .Christian Bach is the author of this plugin which did a fantastic job.
Monday, November 19, 2012
Display Watermark Using jQuery For TextBox Controls
Procedure: Follow these steps.
1. Download the java script that i have created for jquery by clicking this link.
2. Pass the reference of this java script in the head section as follows.
<script src="../Scripts/WaterMark.min.js" type="text/javascript"></script>
Saturday, November 17, 2012
How to display an image gallery using Repeater in ASP.NET
Procedure:
1. Either create a new page or project.
2. Drag and drop a FileUploader and a Button control in your ASPX page.
3. To display a gallery put a Repeater control in the page.
4. In the <ItemTemplate > section of repeater put an image control to display images. Set height and width of this image control.
Thursday, November 15, 2012
Display Tooltip On Mouse Hover Using jQuery UI
Description: Its very simple and just follow these steps.
1. Add reference of jQuery1.9 UI in the aspx page or master page in between <Script> tag
2. Set Title attribute to those html controls for whom you want to show tooltip.
3. Add following method to display tooltip for all control in the html page in between <Script> tag.
$(function () {
$(document).tooltip();
})
This method will display tooltip for all the controls in html page whose title attribute is set.
$(function () {
$('#'txtName).tooltip();
})
However if you want to display tooltip only for selected controls then instead of (doument) you will have to use id (#'txtname') eg of that specific controls.
4. Run your page in the browser to see the effect.
Example:
Thursday, October 11, 2012
An Overview About Generics In C#.NET
The approach of generic programming has been started in 1983 by Ada programming language to reduce the duplication of code by writing a common set of methods and types that differ only by types or environment they are being used.
Introduction:
The term generic programming was originally coined by two guys named David Musser and Alexander Stepanov to describe an approach for software decomposition. In this approach fundamental requirements on types are abstracted from across concrete examples of algorithms and data structures.
So in general terms generic programming is a style of computer programming in which algorithms are written in terms of to-be-specified-later types that are instantiated when needed for specific types provided as parameters.
An Overview Of Dictionary In C#.NET
Dictionary in C# :
- Dictionary is a generic class that belongs to System.Collection namespace in .NET.
- The dictionary type in C# allow user to retrieve corresponding value very fast with key value.
- A dictionary can store Keys and Values of any data type in .NET.
- It provides a mapping from a set of keys to a set of values .
- Represented as Dictionary<TKey, TValue> pair where TKey represents Key and TValue represents the value associated with the key.
Tuesday, October 09, 2012
Optimization Of Stored Procedure In SQL Server
This article describes that how we can optimize the Stored Procedures so that we can get better performance while our application is talking to database. I am enlisting some of the points from my personal experience.
1) Always Use Fully Qualified Name For All Database Objects:
While working with stored procedure we need to pass name of database objects (table, view, function, other stored procedure(s) etc.) several times. I recommend every developer to use fully qualified object names instead of using only object name. There is a very strong reason behind this recommendation.
SQL server always has to find supplied database object name from sys object that took some millisecond of processing time and consumption of CPU resources. And if, we pass fully qualified name then that processing time and CPU resource consumption to search the object from sys objects get reduced to significant amount.
Another reason behind the scene is it helps SQL Server to directly finding the Complied Cache Plan if available instead of searching the objects in other possible schema. This process of searching and deciding a schema for a database object leads to COMPILE lock on stored procedure which decreases the performance of a stored procedure.
Wednesday, October 03, 2012
Overview Of List Type In C#.NET
List Class : List is a member of System.Collection namespace in .NET which is having lots of features.
Declaration: List is declared as follows.
List<int> list = new List<int>();
Description:
List type in C# resizes itself if required hence you don’t need to worry for size of List.
Used for Linear Collection which are not accessed by Keys.
Lists are considered generics and constructed types.
We must have to use <> (angle bracket) in the List declaration.
It provides many attributes and methods to work with List type; some of them are described with example below.
Monday, September 24, 2012
Xml manipulation in ASP.NET using C#
While working with Xml using C# ,yesterday i found it very simple. We can easily create, modify and delete nodes in Xml files. So its not a bif deal to work with it. So i simply give you an example od working with Xml file which is consumed by a web service and displaying records from Xml into a GridView in asp.net page. Following is the sample.