:
The precondition is that your webpage supports UTF-8. For example, the settings in web. config are as follows:
Copy codeThe Code is as follows:
<Configuration>
<System. web>
<Globalization fileEncoding = "UTF-8" requestEncoding = "UTF-8" responseEncoding = "UTF-8"/>
</System. web>
</Configuration>
. Aspx:
Copy codeThe Code is as follows:
<% @ Page Language = "C #" AutoEventWireup = "true" CodeFile = "ShowSymbol. aspx. cs" Inherits = "ShowSymbol" %>
<! 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> </title>
</Head>
<Body>
<Form id = "form1" runat = "server">
<Div>
<Asp: DataList ID = "DataListSymbol" runat = "server" RepeatColumns = "9" RepeatDirection = "Horizontal" Width = "100%">
<ItemStyle BorderStyle = "Solid" BorderWidth = "1px"/>
<ItemTemplate>
<% # Eval ("key") %>: <asp: Label ID = "Label1" runat = "server" Text = '<% # Eval ("value ") %> 'forecolor = "Blue"> </asp: Label>
</ItemTemplate>
</Asp: DataList>
</Div>
</Form>
</Body>
</Html>
. Aspx. cs:
Copy codeThe Code is as follows:
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Web;
Using System. Web. UI;
Using System. Web. UI. WebControls;
Public partial class ShowSymbol: System. Web. UI. Page
{
Protected void Page_Load (object sender, EventArgs e)
{
If (! IsPostBack)
{
Data_Binding ();
}
}
Private void Data_Binding ()
{
This. DataListSymbol. DataSource = Symbol ();
This. DataListSymbol. DataBind ();
}
Private Dictionary <string, string> Symbol ()
{
Dictionary <string, string> sym = new Dictionary <string, string> ();
Sym. Add ("sum", "Σ ");
Sym. Add ("all equal signs", "allow ");
Sym. Add ("Positive and Negative", "± ");
Sym. Add ("plus sign; Positive", "+ ");
Sym. Add ("minus sign; minus sign ","-");
Sym. Add ("multiplication", "× ");
Sym. Add ("except", "allow ");
Sym. Add ("unlimited", "∞ ");
Sym. Add ("because", "role ");
Sym. Add ("so", "role ");
Sym. Add ("vertical to", "vertical ");
Sym. Add ("", "role ");
Sym. Add ("circle", "⊙ ");
Sym. Add ("square root", "√ ");
Sym. Add ("degree", "° ");
Sym. Add ("points ","′");
Sym. Add ("seconds ","″");
Sym. Add ("%... "," % ");
Sym. Add ("Celsius", "℃ ");
Sym. Add ("approx. equal to", "≈ ");
Sym. Add ("diameter symbol", "Ø ");
Sym. Add ("1/4", "Hangzhou ");
Sym. Add ("1/2", "Hangzhou ");
Sym. Add ("3/4", "Hangzhou ");
Sym. Add ("", "¹ ");
Sym. Add ("square symbol", "² ");
Sym. Add ("cube", "cube ");
Return sym;
}
}