code for displaying mathematical symbols in asp.net Web pages-Practical tips

Source: Internet
Author: User
Tags square root
Effect Chart:

The prerequisite is that your Web page is supported Utf-8, as in the Web.config setting as follows:
Copy Code code as follows:

<configuration>
<system.web>
<globalization fileencoding= "Utf-8" requestencoding= "Utf-8" responseencoding= "Utf-8"/>
</system.web>
</configuration>

. aspx:
Copy Code code 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 ">
<title></title>
<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")%&gt: <asp:label id= "Label1" runat= "Server" text= "<%#" eval ("value")%> ' forecolor= ' Blue ' ></asp:Label>
</ItemTemplate>
</asp:DataList>
</div>
</form>
</body>

. Aspx.cs:
Copy Code code 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 ("Full equals number", "Chess");
Sym. ADD ("plus sign", "±");
Sym. ADD ("plus sign; plus", "+");
Sym. ADD ("minus sign; minus sign", "-");
Sym. ADD ("Multiplication", "X");
Sym. ADD ("division", "a");
Sym. ADD ("Infinite Size", "∞");
Sym. ADD ("because", "∵");
Sym. ADD ("So", "∴");
Sym. ADD ("perpendicular to", "⊥");
Sym. ADD ("angle", "∠");
Sym. ADD ("Round", "⊙");
Sym. Add ("Square root", "√");
Sym. ADD ("degree", "°");
Sym. Add ("Min", "′");
Sym. Add ("Seconds", "″");
Sym. ADD ("percent ...", "%");
Sym. ADD ("Celsius", "℃");
Sym. Add ("About equals number", "≈");
Sym. ADD ("diameter symbol", "Ø");
Sym. ADD ("One-fourth symbols", "¼");
Sym. ADD ("One-second symbols", "½");
Sym. ADD ("Three-fourths symbols", "¾");
Sym. ADD ("square symbol", "¹");
Sym. ADD ("square symbol", "²");
Sym. ADD ("cubic symbol", "³");
return sym;
}
}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.