ASP.NET获取中文首字母
//ASP.NET获取中文首字母
public class Converter
{
static public string GetChineseSpell(string strText)
{
int len = strText.Length;
string myStr = "";
for (int i = 0; i < len; i++)
{
myStr += getSpell(strText.Substring(i, 1));
}
return myStr;
}
static public string getSpell(string cnChar)
{
byte[] arrCN = Encoding.Default.GetBytes(cnChar);
if (arrCN.Length > 1)
{
int area = (short)arrCN[0];
int pos = (short)arrCN[1];
int code = (area << 8) + pos;
int[] areacode = { 45217, 45253, 45761, 46318, 46826, 47010, 47297, 47614, 48119, 48119, 49062, 49324, 49896, 50371, 50614, 50622, 50906, 51387, 51446, 52218, 52698, 52698, 52698, 52980, 53689, 54481 };
for (int i = 0; i < 26; i++)
&
相关文档:
关于ClientID的使用我遇到一下问题:
获取由 ASP.NET 生成的服务器控件标识符。
问题一: 用户控件的页面JavaScript中需要使用Asp.net的控件ID,出现不一致。
问题二:母版页的子页面JavaScript中需要使用Asp.net的控件ID,出现不一致。
解决办法:
document.getElementById("<% ......
http://zhanglei1286.blog.163.com/blog/static/1895797120091112113019600/
在后台代码里:
SQL 2000:
static string StrConn = "server=.;uid=sa;pwd=sa;database=MyCUDS";
SQL2005:
con = new SqlConnection(@"Server=.\SQLExpress;Database=db_CMS;Persist Security Info=True;User ID=sa;Password=Masslong");
......
asp.net文件上传(0)
2009年04月13日 星期一 下午 06:11
Default.aspx:
<%@ 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"& ......
ASP.NET提供了Session对象,从而允许程序员识别、存储和处理同一个浏览器对象对服务器上某个特定网络应用程序的若干次请求的上下文信息。Session对应浏览器与服务器的同一次对话,在浏览器第一请求网络应用程序的某个页面时,服务器会触发Session_onStart事件;在对话超时或者被关闭的时候会触发Session_onEnd 事件。程序员 ......
web.config关于sessionState节点的配置方案,sessionState有四种模式:off,inProc,StateServer,SqlServer。
1、off模式
从字面上就可以看出这个是关闭模式,如果当前页面不需要session的值,为了减少服务器资源,你可以去掉Session的开销。
<sessionState mode="off">或者页面上
<%@ Page EnableSessionState= ......