Email: Password:       Forgot Password 
    .netCodeSG
A Saarsha Group Online Community for dot net codes group like C#, Asp.NET, VB.NET, Sharepoint, JavaScript, JQuery, Ajax, SQL, WCF, WPF.
 
TECHNOLOGIES:
 

Country List With their Culture in ASP.Net

Article:
Viewed:  1176 
Posted On:  16/03/2013 08:41:44 
In this article I am going to show how we can show country list with their Country code and language code. 

In this article I am going to show how we can show country list with their language code.

Below is the output of my program:

1.png

Image 1.

My aspx for this:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Country List By Their Culture</title>
</head>
<body>
    <form id="form1" runat="server">
    <table cellpadding="1" cellspacing="1" width="50%" align="center" style="background: skyblue;">
        <tr>
            <td align="center">
                <asp:Button ID="btnGetCountryCulture" runat="server" Text="Get Country~Culture" OnClick="btnGetCountryCulture_Click"
                    BorderStyle="Double" BorderColor="AliceBlue" />
            </td>
        </tr>
    </table>
    <div>
        &nbsp;</div>
    <div id="Country_Culture_Info" runat="server" style="width: 800px; height: 400px;
        overflow: auto;">
    </div>
    </form>
</body>
</html>
 
aspx.cs Code:

using
System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
sing
System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Globalization;
using System.Text;
 
public partial class _Default : System.Web.UI.Page
{

   protected void Page_Load(object sender, EventArgs e)
    {
 
    }

    
protected void btnGetCountryCulture_Click(object sender, EventArgs e)
    {
        CultureInfo[] culture_Info = CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures);
        StringBuilder get_Info = new StringBuilder();
        get_Info.Append("<table border=\"1\" width=\"95%\" align=\"center\" style=\"border:solid 1 black;border-collapse:collapse;background: #81F7D8\"><tr>
th>Country Name</th><th>Language-Country code</th></tr>"
);

        foreach (CultureInfo item in culture_Info)
        {
            get_Info.Append("<tr>");
            get_Info.Append("<td>" + item.DisplayName + " </td><td> " + item.Name + "</td>");
            get_Info.Append("</tr>");
 
        }
        Country_Culture_Info.InnerHtml = get_Info.ToString();
    }
}

  Comment:
 
By Yogesh  On  05/04/2013 03:40:26
gud one..
         HOME   |   Submit Article   |   Contact Us   |   About Us   |   Terms & Condition   |   Advertise With us