Saturday, May 30, 2009

Adding Country Name to DropDwonList..

Objective:
This small application will describe how easily we can get all the country names and how easily we can show all the country names in a dropdown list by using asp.net with C#..

Problem:
In any registration page we need user should select Country from the dropdown list and for this we have to add Country Name one by one.. I think it’s very difficult to remember all the Country Name and add to dropdown list…

Solution: step by step
Step 1: Take one asp.net with C# application by using VS.Net 2.0;
Step 2: Design the form (Reg.aspx page)

Step 3: Go to Solution Explorer and add one folder named as App_Code



Step 4: Inside App_Code ->Add New Item-> add one class named as GetCountryNames.cs


Step 5: code inside GetCountryNames.cs file


Step 6: Code for Reg.aspx.cs file..



Step 7: Now Run your Application: (Output will be like this)..


Hope u enjoy this code....

No comments:

Bookmark and Share