aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

C# Coding Standards and Best Programming Practices

Apr 26, 2010 33 comments

Anybody can write code. With a few months of programming experience, you can write 'working applications'. Making it work is easy, but doing it the right way requires more work, than just making it work.

Believe it, majority of the programmers write 'working code', but not ‘good code'. Writing 'good code' is an art and you must learn and practice it.

Everyone may have different definitions for the term ‘good code’. In my definition, the following are the characteristics of good code.

·         Reliable
·         Maintainable
·         Efficient

How to Merger the two datatbles into one table in

Apr 22, 2010 7 comments
It is very easy to merge two data tables into one table in 

Using Merge Method ucan add two tables

 DataTable dt = new DataTable();
DataTable dt1 = new DataTable();


 I think it helps you

Introduction to Object Oriented Programming Concepts (OOPS) in

Apr 16, 2010 517 comments
OOPS Concepts


 It is a collection of objects.


It is a real time entity.
An object can be considered a "thing" that can perform a set of related activities. The set of activities that the object performs defines the object's behavior. For example, the hand can grip something or a Student (object) can give the name or address. In pure OOP terms an object is an instance of a class

Set Color of GridLines in Gridview

There are times when you will want to set the color of the grid lines in your GridView - however there is not to my knowledge a way of doing this declaratively. A workaround is to do this by tapping into the GridView's RowDataBound event.

First, set the OnRowDataBound property in the markup of the GridView:


Second, set the color in the OnRowDataBound handler method:

protected void MyGrid_RowDataBound(object sender, GridViewRowEventArgs e)

        foreach (TableCell tc in e.Row.Cells)

            tc.Attributes["style"] = "border-color: #c3cecc";



Happy Coding

Setting up your ASP.NET server (IIS)

Apr 15, 2010 1 comments
  A guide that shows you how to install IIS server and configure it to work with ASP.NET, not just with ASP.

Before starting, be sure you have .NET Framework installed. If not, you can install it using Windows Update or download the package and install manually.

ASP runs inside IIS (Internet Information Services). Therefore first you should install IIS (under Windows 2000, Windows XP or Windows 2003), of course if it isn't already installed.
Usually, you can install it from Control Panel / Add or Remove Programs / Add/Remove Windows Components.

Go to Start Menu / All Programs / Administrative Tools / Internet Information Services.
Choose your computer name (local computer) / Web Sites / Default Web Site.
Right click 'Default Web Site' and select 'Properties'. Choose the 'Home Directory' tab and type in the 'Local Path' the path to where you want your files to be stored. For example 'D:\Server\iis'. This is the root of your webserver, this folder will open when you type http://localhost in your web broswer.
Below, check the 'Script source access', 'Read', 'Write' and 'Directory browsing' values. Click OK and now let's start the server.

Click on the 'Start item' button to start the service. Be sure you don't have any other server running on localhost, Apache for example.

Changing the Color of Selected item in menu using javascript

Apr 8, 2010 6 comments
In header Section you should write the this script function

<script language="javascript">
var selectEl = null; // keep track of currently selected
function mo(el) {
    if (selectEl) { // unselect selected = 'gray'; = '0px inset black';
    selectEl = el; // new selected = 'navy';

Detect Browser Refresh to avoid events fired again in ASP.NET

Apr 6, 2010 21 comments

If you have created an aspx page using C# and ASP.NET and have put a button on it. And in the Click event of this button if you are inserting some data in database , after click if user refresh the page than click event gets fired again resulting data insertion to database again, to stop events on the page getting fired on browser refresh we need to write bit of code to avoid it.

In this example I’ve put a Label and a Button on the page, on click the label Text becomes Hello and when I refresh the page label's text again becomes Hello

Generating Random Number and String in C# or Generating the Password Automatically By using with c#


Hi friends here I have written the code to generate the auto generated password 

open the visual studio 
select the new website

After that copy and paste the following code in aspx page

C# - Difference between Abstract class and Interface in Asp.Net

In previous article I explained complete OOPS Concept. Now I will explain differences between Abstract classes and Interfaces.

An Abstract class without any implementation just looks like an Interface; however there are lot of differences than similarities between an Abstract class and an Interface. Let's explain both concepts and compare their similarities and differences.

What is an Abstract Class?

An abstract class is a special kind of class that cannot be instantiated. So the question is why we need a class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses. In simple words, it is a kind of contract that forces all the subclasses to carry on the same hierarchies or standards.

Maintaining State of CheckBoxes While Paging in a GridView Control

Apr 3, 2010 36 comments
In this article I will explain how to maintain state of selected checkboxes during paging in gridview using

I have one gridview with checkboxes and it contains lot of data for that reason I applied paging for gridview and displaying 8 records per page. After apply the paging in gridview if I select checkboxes in first page and moving to another page and select some checkboxes in second page after that if I come back I am unable to see the previous selected values. At that time I know one new thing that is gridview won’t maintain the state of controls during postback for that reason we need write some code to maintain the previous selected values in gridview. Before seeing the code implemention first Design your aspx page like this

how to Create RSS feed Using | RSS Feed Sample using


Here I will explain how to create RSS feed using


RSS stands for "Really Simple Syndication". RSS solves a problem for people who regularly use the web. It allows you to easily stay informed by retrieving the latest content from the sites you are interested in. You save time by not needing to visit each site individually.

how to import Contacts from GMAIL using ASP.NET and C#

Apr 2, 2010 64 comments

In this article I will explain how to import gmail contacts of a user by using GContacts Data API provided by Google.


We have developed one social network site at that time we think that how to popularize the our social network site I have checked some of social network sites at that time we got idea to implement import contacts concept is best to intimate all of our friends at a time I have searched so many websites to implement this concepts but no result finally I have implemented import contacts from gmail 

Other Related Posts

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.