CultureInfo学习

此博客展示了使用C#和XHTML实现文化信息展示的代码。通过C#代码获取特定文化信息并生成表格,XHTML用于构建页面结构。代码中包含页面设置、表格标题和内容的生成,最终在页面上呈现文化信息表格。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ExpandedBlockStart.gifContractedBlock.gif<%dot.gif@ Page Language="C#" ResponseEncoding="utf-8" %>
ExpandedBlockStart.gifContractedBlock.gif
<%dot.gif@Import Namespace="System.Globalization"%>
ExpandedBlockStart.gifContractedBlock.gif
<%dot.gif@Import Namespace="System.Threading"%>
None.gif
None.gif
None.gif
None.gif
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
None.gif
ExpandedBlockStart.gifContractedBlock.gif
<script runat="server">dot.gif
InBlock.gif    protected 
void Page_Load(object send, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        HtmlTableRow r;
InBlock.gif        HtmlTableCell c;
InBlock.gif        
int row = 0;
InBlock.gif
InBlock.gif        
//Titel
InBlock.gif
        r = new HtmlTableRow();
InBlock.gif        r.BgColor 
= "#0065CE";
InBlock.gif        c 
= new HtmlTableCell(); c.InnerText = "Name"; c.Attributes.Add("style""color:#ffffff;text-align:center;font-weight: bold"); r.Cells.Add(c);
InBlock.gif        c 
= new HtmlTableCell(); c.InnerText = "DisplayName"; c.Attributes.Add("style""color:#ffffff;text-align:center;font-weight: bold"); r.Cells.Add(c);
InBlock.gif        c 
= new HtmlTableCell(); c.InnerText = "EnglishName"; c.Attributes.Add("style""color:#ffffff;text-align:center;font-weight: bold"); r.Cells.Add(c);
InBlock.gif        c 
= new HtmlTableCell(); c.InnerText = "NativeName"; c.Attributes.Add("style""color:#ffffff;text-align:center;font-weight: bold"); r.Cells.Add(c);
InBlock.gif        c 
= new HtmlTableCell(); c.InnerText = "LCID"; c.Attributes.Add("style""color:#ffffff;text-align:center;font-weight: bold"); r.Cells.Add(c);
InBlock.gif        c 
= new HtmlTableCell(); c.InnerText = "语言代码"; c.Attributes.Add("style""color:#ffffff;text-align:center;font-weight: bold"); r.Cells.Add(c);
InBlock.gif        c 
= new HtmlTableCell(); c.InnerText = "ISO 639-1代码"; c.Attributes.Add("style""color:#ffffff;text-align:center;font-weight: bold"); r.Cells.Add(c);
InBlock.gif        
InBlock.gif        objTable.Rows.Add(r);
InBlock.gif        foreach (CultureInfo culture 
in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            r 
= new HtmlTableRow();
InBlock.gif            
if (row % 2 == 1)
InBlock.gif                r.BgColor 
= "Gainsboro";
InBlock.gif
InBlock.gif            c 
= new HtmlTableCell(); c.InnerText = culture.Name; r.Cells.Add(c);
InBlock.gif            c 
= new HtmlTableCell(); c.InnerText = culture.DisplayName; r.Cells.Add(c);
InBlock.gif            c 
= new HtmlTableCell(); c.InnerText = culture.EnglishName; r.Cells.Add(c);
InBlock.gif            c 
= new HtmlTableCell(); c.InnerText = culture.NativeName; r.Cells.Add(c);
InBlock.gif            c 
= new HtmlTableCell(); c.InnerText = culture.LCID.ToString(); r.Cells.Add(c);
InBlock.gif            c 
= new HtmlTableCell(); c.InnerText = culture.ThreeLetterISOLanguageName; r.Cells.Add(c);
InBlock.gif            c 
= new HtmlTableCell(); c.InnerText = culture.ThreeLetterWindowsLanguageName; r.Cells.Add(c);
InBlock.gif            
InBlock.gif            objTable.Rows.Add(r);
InBlock.gif            row
++;
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedBlockEnd.gif    }

None.gif
</script>
None.gif
None.gif
<html xmlns="http://www.w3.org/1999/xhtml" >
None.gif
<head>
None.gif    
<title>CultureInfo</title>
ExpandedBlockStart.gifContractedBlock.gif    
<style>dot.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    td
{dot.gif}{font-size:12px}
ExpandedBlockEnd.gif    
</style>
None.gif
</head>
None.gif
<body bgcolor="white" leftmargin="0">
None.gif    
<form id="form1" runat="server">
None.gif    
<div>
None.gif    
<table id="objTable" runat="server"></table> 
None.gif    
</div>
None.gif    
</form>
None.gif
</body>
None.gif
</html>
None.gif
None.gif
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值