Monday, January 31, 2011



We can use ExecuteScalar() method, if we have to retrieve a single value from a database. It executes the query and returns the first column of the first row in the result set returned by the query. Additional rows and columns are simply discarded. It returns a maximum of 2033 characters. It is better to get the result of MAX,MIN,COUNT, etc using ExecuteScalar() method. 

Sunday, January 30, 2011

Data Adapter

Data Provider has 4 components. Among these 4 components, i have covered Data Adapter and two of its methods.

  A Data Adapter is a bridge between the Data Source and the data set.Select,Insert,Update,Delete operations in the Data Source can be performed by data adapter. A Data Adapter contains a connection object and a command object. It manages data in a disconnected mode. And opens and closes connection automatically, when reading or writing to a database. 

Friday, January 28, 2011

File Upload using Javascript

In this small article, i have tried to show u, how to check the extension of a file which is being browsed by the FileUpload control.
                          Sometimes we may need to check the extension of the file browsed, in our client side only. Then we can use the following javascript function.

Master Page and Content Page

Using Master page we can create a consistent layout for the pages in our application.  The look and feel of all the pages in our application can be defined using a single master page. Individual content pages are created which contain the content which we want to display.

Thursday, January 20, 2011

Difference between ref and out parameters

Recently, I have come across a query in a forum. The query was something like 'difference between ref and out parameters'. Hence, I have just tried to point out the difference between the two.


We can pass ref and out parameters through the methods as arguments.

Out Parameter

In case of out parameter , the caller method need not assign a value to the out parameter. Instead the callee method is responsible to assign value in the out parameter.
Let me show u examples:
Sending single unassigned variable using out parameter. 

Saturday, January 15, 2011

Private and Shared Assembly


An assembly is a compiled code library in .NET Framework. It is a logical unit of code.

Types of Assemblies

Assemblies are of two types.
  1. Private Assemblies
  2. Shared Assemblies

Private Assemblies

Assemblies which are used by single application are called "Private Assemblies". In this case, the bin\Debug\*.dll gets copied in the folder, in which the client application is present.

Dynamically Adding an item in a DropDownList Control


In this article, i am going to show the different ways of dynamic addition of an item in a DropDownList control.

1. Using jquery(HTML controls)
2. Using jquery(ASP.NET controls)
3. Using javascript
4. Using AppendDataBoundItems

Bulk Email sending through Gmail


Nowadays, bulk mailing is a major concern for the business persons.  Every feature has its advantages and disadvantages of its own. Bulk email is also termed as ‘Spam Mailing’. Using this feature, one can make grand advertisements, send newsletters,etc.
    The disadvantage is that, it may not available in the inbox of the recipient, instead it may be available in the spam folder, where the chance of noticing the mail is very less. This is actually done by bulk email blocker programmed into email accounts.
    Advantage of bulk mailing is that, very less time is spend for sending mail to so many recipients.
In this article, I will show you , how to send bulk-mail using Gmail.

Form View in Edit, Insert and Read-Only Mode


FormView Control enables us to display a single record in a browser, from a data source. It allows you to edit, delete, and insert records.

Difference between FormView and DetailsView Control

The DetailsView control uses a tabular layout where each field of the record is displayed  as a row of its own. Whereas, the FormsView control uses a template to display a single record at a time.

The FormView control can be customized by adding templates that allow the user to view or modify the data displayed by the control. 

Paging with a Repeater Control


The Repeater control is a data-bound control. It uses templates to display data. It lacks the built-in support for paging, editing and sorting. The Repeater control may be bound to a database table, and an XML file. In this control, the content and layout of list items is defined using Templates. Every Repeater must define an ItemTemplate. 

Displaying clickable image in a GridView


In this article, i have tried to show an image in each of the row of the GridView control. And on clicking on these images one is navigated to another page.

I have shown here 2 examples using:
1. Image field
2. Image Button

How to work with Query String ?


In Web development, passing of parameters from one page to another is an essential part. By using QueryString, one can easily transmit data from one page to another. These QueryStrings  are simply the data that is appended to the end of a page URL. The user can see the values which the query string holds without using special operations like ViewSource.

FileUpload Server Control


By using the FileUpload control, one can upload pictures, text files, or other file. After selecting the file, the FileUpload control doesn’t automatically send a file to the server. To allow the user to submit the form, you must explicitly provide a control or mechanism. An event is needed to be raised, and within the even handler method, the code to save a file or to handle the contents of the file are handled.

Adrotator Control Using XML, SqlDataSource and Timer Control


The AdRotator Web Server control provides a way to display graphic images on your ASP.NET web pages. One use of the AdRotator is to show banner-style advertisements on a page. The control automatically reads advertisement information, such as the graphic file name and the target URL, from a list of ads that you provide using a data source. Here datasource may be an XML file or may be a database table also. I am going to show you examples where I have used both of these. Hope you will like it.

Cookies for the Beginners


A Cookie is a small text file that is either saved on a client’s hard drive or client’s web browser. It contains site specific information that the server sends to the client along with the page output. The cookies are saved on the client device, and whenever the browser requests for a page, the information in the cookie is sent to the server by the client. The cookie is then read and its value is extracted by the server. Cookies are associated with a Web Site not with a specific page, so the browser and the server will exchange cookie information. Hence, it doesn’t matter which page the user requests from your site.

Regular Expression Validator Control


By using this RegularExpressionValidator control, you can check a user’s input based on a pattern that you define using a regular expression. This type of control allows you to check for predictable sequences of characters, such as those in email addresses, telephone numbers, postal codes, and so on.

Menu Control for Beginners


The Menu control is used to display expandable menu. You can use this menu to navigate to different pages of your site. When the cursor hovers over the menu, a node that contains child nodes is found to be expanded.  Here, I have shown all the steps in details for a beginner, who is using this Menu control for the first time.
I have dealt with the Text property and NavigateUrl property of the Menu control. The value of the Text property is displayed in the Menu control. If the NavigateUrl property of a menu item is set, the Menu control navigates to the linked page.

The person whom i admire

Here i want to state that i really admire few persons who are gems in .NET . But i could make contact only with very few of them. Among them i know a person whom i really admire most. 

He is no one but Mr. Abhijit Jana MVP(MS + CP) . I had first read one of his article in Code Project. Thereafter he helped me many a times in solving problems, related to .NET. Frankly speaking, I like his writing, as they are explained in a very simple and detailed manner.
           Keep rocking in this way.