Monday, December 31, 2012

Tuesday, December 25, 2012

Return SQL Query Result as XML in SQL Server- AUTO Mode

In previous post Return SQL Query Result as XML in SQL Server , I explained For XML clause for getting the query result as XML. I also explained RAW mode of this clause. Today I will explain AUTO  mode in FOR XML  clause.

Monday, December 24, 2012

Return SQL Query Result as XML in SQL Server

SQL Server gives you option to retrieve data as XML by supporting For XML clause, which you can use as a part of your query. For XML clause supports different options that let you define the format of XML data.

For XML clause supports four modes- RAW, AUTO, EXPLICIT, PATH. When you include the FOR XML clause in your query, you must specify one of these four modes.

Thursday, December 13, 2012

Validate ListBox and DropDown List using Required Field Validator

In Asp.Net, sometimes we need to validate List Box and Drop Down List using Required Field validator. Here I am sharing the code for validating List Box and Drop Down List, it is tricky and avoids to use java script function for validation.

Monday, December 10, 2012

How to delete row in data table?

In ASP.Net, we use the data tables very frequently in our application. Sometimes we need to delete the row from the data table using some filter condition. Today I will show you a simple example to delete the row from your data table based on your condition.
We have a data table structure as showing below in the image:

Saturday, December 8, 2012

Disable right click on web page and images

Sometimes it is required to prevent images on web pages being copied by another one. You can prevent the images by disabling the right click on your web page or by disabling image context menu on images only. Here I am going to share that how can you achieve this?

Disable right click on images
For disabling the image context menu on right click on images, just add the below event handler to the img or image tag as shown below

How to pass an array in a Query String?

Today I am going to give an example of passing an array in a query string. We have two pages one is Sender.aspx and second is Receiver.aspx. We will create the ArrayList in Sender.aspx and sent it to Receiver.aspx.

Friday, December 7, 2012

Creating data table programmatically in C#

Sometimes we need to create the data table programmatically in code behind. Here I am giving you a simple example of creating data table programmatically in C#.

Thursday, December 6, 2012

Select random records from database (MySQL, Oracle, MS SQL)

Sometimes we need to select random records from a table in our database. For example, if you created online test application then every time we need to get the random questions from our questions table.
Today I will give you some examples for selecting random records in some popular databases.

Tuesday, December 4, 2012

LINQ Operators:Partition Operators

This post is the part of series called LINQ Operators that brings the practical examples of LINQ operators. In previous posts we have learned about Filtering and Projection operators.Today we will see the Partition Operators in LINQ.


Monday, December 3, 2012

Friday, November 30, 2012

LINQ Operators : Filtering Operators

LINQ operators are a collection of methods that form the heart and soul of the LINQ(Language Integrated Query). The best thing of these operators is how they can execute against different data sources. You can use these operators not only to query object in memory but you can use same operators to query object stored in relational database, in XML, datasets and more.


Wednesday, November 28, 2012

Bind dropdownlist to xml file

Today I was working on binding the dropdown list control from an  XML file. Besides binding the dropdown list from XML file I had to sort the items into ascending order. So I am explaining here what I have done for this.

Let’s define an  XML file first. It consists of Department name of a company.

Tuesday, November 27, 2012

Highlight gridview row on mouse over in asp net web page

In ASP.Net, programmers heavily use the gridview control for data display. Adding some effects in gridview will change the look and feel and make it more interactive for users. One such of effects is highlighting the gridview row on mouse over. With this short background let's go for the design markup of the example gridview.

Monday, November 26, 2012

Creating Captcha Code in ASP.Net

Before entering in to the topic first we must know “What is the Captcha code?” and “Why we used it?” Most of the web sites having the Captcha validation to their sites.

What is the Captcha code?
Captcha code is simply a combination of some characters and numbers like ‘Alk13’ or ‘aTu2eP’ etc.

Why we used it?
We used it for validating this code was really typed by the human.

Wednesday, November 7, 2012

Partial Methods in C#

All of us know that partial type allows us to split definition of type across multiple files but do you know C# also provides supports for partial methods too. Partial methods are used when your code is auto generated by code generation tool. The tool will write only method definition and leave the implementation of for developer if they want to customize.

Thursday, October 25, 2012

OnClientClickevent and AJAX is not working for telerik RadControls

One may need to provide a confirmation dialog or check some validation to the users and initiate an AJAX request if confirmation accepted or validation perform successful. Confirmation using standard post backs often looks like this: 

<asp:Button ID="btnSaveComplaint" runat="server" Text="Save" OnClick="btnSaveComplaint_Click" OnClientClick="return ValidateMacroText();" /> 
 Note: ValidateMacroText() is javascript function which returns true if validation perform successfully.

Friday, October 5, 2012

SQl Server Tricks-Part2

Get list of all procedures created on a particular date in a database

To get the list of all the procedures created on a particular date in a data base, you can use this query.

Use YourDBName
select name from sys.objects
where type = 'P'
and create_date=@yourdate

Thursday, October 4, 2012

SQl Server Tricks-Part1

Getting the List of all databases on a server

To get list of all database on a server, you can use this query.
USE master

FROM sys.Databases
OR you can use the sp_helpdb procedure for this.

Wednesday, September 19, 2012

Getting Information About Object's Type

You can get the information of type of the any object by calling the GetType method of System.Object. Because every type in .Net inherits directly or indirectly from System.Object, every object will have access to the GetType method.

GetType returns an instance of a Type object, which can be queried to learn all about the type of the original object.

Monday, September 17, 2012

Contextual Keywords

There are some keywords in C# that are considered contextual keyword, in that these are not reserved keywords but provides specific meaning in the code.Technically you can use these  keywords as an identifiers but you should avoid to doing this, since it could lead to confusion.

Saturday, September 15, 2012

Examine IL Using ildasm.exe

In .Net , source is compiled to an Intermediate Language called Common Intermediate Language. This  IL is later compiled into native code at runtime, running in a virtual machine.
You can examine the IL of your application by a tool called IL Disassembler (ildasm.exe). You can find this tool (ildasm) in directory: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin

Ildasm will show you three basic things of IL :-
  • A list of all classes and methods in your assembly
  • The contents of the assembly’s manifest
  • IL code for any method implemented in the assembly.
 Here’s an example of what is displayed in ildasm.


You can get more information from these sites-
  1. MSIL Disassembler (Ildasm.exe)
  2. Ildasm.exe Tutorial

Wednesday, June 27, 2012

C# Static Methods

Static methods have no instances. They are called with the type name, not an instance identifier i.e we have no need to create the instance of class to call the static methods.So they are slightly faster than instance methods.
The static methods use the static keyword somewhere in the method declaration signature, usually as the first keyword or the second keyword after public

Wednesday, June 13, 2012

Extension Methods in C#

In this post, we will take a look at what extension methods are and how to use them in C#. Extension methods are one of the best things that have been introduced in .Net framework in terms of readability. Extension methods are available from .Net framework 3.5.

Monday, June 11, 2012

Partial Classes and Methods

Partial Classes and Methods

C# 2.0 introduced partial types to allow class definitions to be split between several files. C# 3.0 extends the concept with partial methods, allowing method signatures to be declared but not implemented. This is ideal for use with code generation tools.
In this post , I will try to explain the basic rules of partial classes and methods and how simple it is to use partial methods.

Wednesday, May 30, 2012

Sealed Classes and Methods

Sealed Classes

Sealed Classes are those classes that cannot be inherited by other classes. If we want to prevent a class to be inherited by other class then we make that class as Sealed Class. To create a class as sealed class, create the class using the keyword sealed.


[Access Modifier] sealed class classname
//Class Body

Tuesday, May 29, 2012

Serialization in C#

Serialization in C#

Serialization is the process of converting an object into stream of bytes in order to persist it to memory, a database or a file. Its main purpose is to save the state of an object for the later uses when needed. The reverse process is call deserialization.

Thursday, May 24, 2012

State Management Techniques in ASP.Net-Part2

In previous post State Management Techniques in ASp.Net, we discussed about State Management and Client-Side State Management Techniques. Today we will discuss about Server-Side State Management Techniques.

Server-Side State Management Techniques

In ASP.Net , we have a various ways to maintain the state information on server side,  rather than maintaining it on client side. Application, Session and Database are the different mechanism for sever side state management.

Monday, May 21, 2012

State Management Techniques in ASP.Net-Part1

State Management Techniques in ASP.Net

In this post we discuss various options for state management in web applications, developed in ASP.Net. Generally, web applications are based on stateless HTTP protocol which does not preserve any information associated with the page and controls on each round trip(client - server- client communication). In typical client-server communication using HTTP protocol, a new instance of the Web Page created  in every page request.

Friday, May 18, 2012

Page Life Cycle in ASP.NET

In this post, we will understand the Page Life Cycle in ASp.Net. It is very important to understand the Page Life Cycle in Asp.Net for many reasons, mainly for understanding where we can place particular methods and set page properties efficiently.

 If you are a fresher even experienced then you will see that this is a very common question in the interviews that “Explain the Page Life Cycle of Asp.Net?”

So here I am trying to explain the Page Life Cycle in simple way .I hope this will help you to understand this.

.NET History & Information

.Net History

Microsoft .Net is a new internet technology or rather strategy introduced by Microsoft. .Net was originally known as the NGWS (Next Generation Windows Services) which was said to be an Internet based platform of Next Generation Windows Services.Before the official announcement of .Net, NGWS was the term used to describe the above phrase.

C Interview Questions and Answers

Hello Fiiends,Today I am posting some C Interview Questions and Answers . All the questions and their answers are taken from the site You can go through this site for more interview questions. I hope this will help all of you.

Q. What is C language?
The C programming language is a standardized programming language developed in the early 1970s by Ken            Thompson and Dennis Ritchie for use on the UNIX operating system. It has since spread to many other operating systems, and is one of the most widely used programming languages. C is prized for its efficiency, and is the most popular programming language for writing system software, though it is also used for writing  applications.

If You Enjoyed This Post Please Take 5 Seconds To Share It.

^ Scroll to Top hgpromo