13 September, 2012

HTTP Error 404.3

Did you find the error “HTTP Error 404.3” ? Yes, I found the error at the time of deploying my ASP.NET web application to IIS 7. I found the following error (screen shot).

To solve the error follow the following steps:
Step 1: Go to Control Panel -> Programs and Features -> Turn Windows Features on or off
Step 2: Mark the features as like following image.
Step 3: Click OK and reset IIS.

06 September, 2012

Populate Dropdownlist with selected Index

This is a demo to populate asp.net dropdownlist by C#.

Step 1: Create a asp.net dropdownlist

Create a dropdownlist in asp.net page. Here, I created a dropdownlist name ddlStudentInfo.

<asp:DropDownList ID = "ddlStudentInfo" runat = "server" Height="19px"

Step 2: Create StudentInfo class

Create a student info class to create list of StudentInfo object.
public class StudentInfo
    public int Id { get; set; }
    public string Name { get; set; }

Step 3: Populate dropdownlist

Create a list of StudentInfo object. Make it data source of dropdownlist and choose your selected index. Here, I choose selected index 2 means dropdownlist shows Asrafuzzaman as selected text and 3 as selected value. I have write all those in Page Load. You can do as you required.
protected void Page_Load(object sender, EventArgs e)
        List lstStudentInfo = new List();

        StudentInfo objStudentInfo1 = new StudentInfo();
        objStudentInfo1.Id = 1;
        objStudentInfo1.Name = "Mahedee Hasan";


        StudentInfo objStudentInfo2 = new StudentInfo();
        objStudentInfo2.Id = 2;
        objStudentInfo2.Name = "Mahmud Ahsan";

        StudentInfo objStudentInfo3 = new StudentInfo();
        objStudentInfo3.Id = 3;
        objStudentInfo3.Name = "Asrafuzzaman";

        StudentInfo objStudentInfo4 = new StudentInfo();
        objStudentInfo4.Id = 4;
        objStudentInfo4.Name = "Enamul Haque";

        ddlStudentInfo.DataSource = lstStudentInfo;
        ddlStudentInfo.DataValueField = "Id";
        ddlStudentInfo.DataTextField = "Name";
        ddlStudentInfo.SelectedIndex = 2; //Selected index 2 means selected value is 3 and text is Asrafuzzaman


Now, run the page you will see this.

05 September, 2012

Procedural VS Object Oriented Programming

Object Oriented and Procedural are two programming paradigm. Procedural programming creates a step by step program that guides the application through a sequence of instructions. Procedural programming is also called linear programming. Generally, code is executed from the top of the file to the bottom in procedural programming. Object Oriented uses object to design applications and computer programs. It isn't as linear as procedural programming. Code is often broken up and distributed across multiple files, each one with a single purpose.

1.    Programming Style: Procedural is linear programming and OOP is not linear programing.

2.  Fundamental Unit: Function is the fundamental unit of procedural programming and object is the fundamental unit of OOP.

3.  Code Organization: In procedural programming code is organized into small procedures. This procedure is used to perform any operation.

In object oriented programming, the data and related functions are bundled together into an object.

4.    Data Orientation: In procedural programming functions have no intrinsic relationship with the data they operate on. Here, you provide the correct number and type of arguments, the function will do its work and returns its output.

In object oriented programming, the data and related functions are bundled together into an "object". Ideally, the data inside an object can only be manipulated by calling the object's functions.

5.    Global and Shared data: We can see that one of the principle differences is that procedural systems make use of shared and global data, while object oriented systems lock their data privately away in objects.

6.   Reusability: Reusability is one of the best features of OOP. Reusability is higher than procedural programming.

7.    Abstraction: Abstraction of OOP is higher than procedural programming so maintenance is easy.

8.  Inheritance: Inheritance is the key of OOP but Procedural programming doesn’t support inheritance.

9. Encapsulation & Polymorphism:  Encapsulation and polymorphism is two key features of OOP which are absent in procedural programming.

    10. Coupling and Cohesion: Loosely couple and maximum cohesion in the system is only possible by OOP but it is not possible by procedural programming.

11.  Cost: OOP takes less cost than Procedural programming.