在网页中显示数学符号

在网页中显示一些符号,如数学符号(Insus.NET仅提供常用符号):

前提条件是你的网页是支持utf-8,如在web.config设置如下:

View Code
< configuration > 
   < system.web >   
     < globalization  fileEncoding ="utf-8"  requestEncoding ="utf-8"  responseEncoding ="utf-8"   />   
   </ system.web > 
</ configuration >

 

.aspx:

View Code
<% @ 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 " %>: &nbsp; < asp:Label  ID ="Label1"  runat ="server"  Text ='<%#  Eval("value") % >'  ForeColor="Blue"> </ asp:Label >
             </ ItemTemplate >
         </ asp:DataList >
     </ div >
     </ form >
</ body >
</ html >

 

.aspx.cs:

View Code
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< stringstring> Symbol()
    {
        Dictionary< stringstring> sym =  new Dictionary< stringstring>();
        sym.Add( " 总和 "" ");
        sym.Add( " 全等于号 "" ");
        sym.Add( " 正负号 "" ± ");
        sym.Add( " 加号;正号 "" ");
        sym.Add( " 减号;负号 "" ");
        sym.Add( " 乘号 "" × ");
        sym.Add( " 除号 "" ÷ ");
        sym.Add( " 无限大号 "" ");
        sym.Add( " 因为 "" ");
        sym.Add( " 所以 "" ");
        sym.Add( " 垂直于 "" ");
        sym.Add( " "" ");
        sym.Add( " "" ");
        sym.Add( " 平方根 "" ");
        sym.Add( " "" ° ");
        sym.Add( " "" ");
        sym.Add( " "" ");
        sym.Add( " 百分之… "" ");
        sym.Add( " 摄氏度 "" ");
        sym.Add( " 约等于号 "" ");
        sym.Add( " 直径符号 "" Ø ");
        sym.Add( " 四分之一符号 "" ¼ ");
        sym.Add( " 二分之一符号 "" ½ ");
        sym.Add( " 四分之三符号 "" ¾ ");
        sym.Add( " 一次方符号 "" ¹ ");
        sym.Add( " 平方符号 "" ² ");
        sym.Add( " 立方符号 "" ³ ");       
         return sym;
    }
}

 


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值