当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > ASP.NET多语言支持

ASP.NET
asp.net GridView控件中模板列CheckBox全选、反选、取消
asp.net GridView 删除时弹出确认对话框(包括内容提示)
asp.net DropDownList 三级联动下拉菜单实现代码
asp DataTable添加列和行的三种方法
Asp.net 页面调用javascript变量的值
asp.net 长文章通过设定的行数分页
asp.net 定时间点执行任务的简易解决办法
asp.net 页面延时五秒,跳转到另外的页面
asp.net 动态输出透明gif图片
asp.net DataList与Repeater用法区别
asp.net Javascript获取CheckBoxList的value
asp.net程序在调式和发布之间图片路径问题的解决方法
asp.net下生成英文字符数字验证码的代码
asp.net 页面版文本框智能提示JSCode (升级版)
ASP.NET URL伪静态重写实现方法
ASP.NET 2.0 中Forms安全认证
asp.net 动态添加多个用户控件
asp.net Repeater显示父子表数据,无闪烁
asp.net 无法获取的内部内容,因为该内容不是文本 的解决方法
asp.net GridView排序简单实现

ASP.NET多语言支持


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 44 ::
收藏到网摘: n/a

2000-12-12· crystal译 ·yesky

  asp.net支持多种语言,它的缺省语言将是:visual basic而不是vbscript,这意味着我们可以摆脱vbscript的语言限
制,我们的代码将是编译后运行的(而不是原来的解释执行)。

  Visual Basic

  让VBScript 一边去吧。ASP现在全部用成熟的VB语言来书写。感觉还不错,不是吗?不过,VB有了一些改动。VB中的
主要改变,不再有Set & Let,不再有缺省属性,Parenthesis现在被称为SUBS,Arguments需通过缺省设置来实现
BYVAL,Integer 为32位,Long为64位,And" and "Or“ 省略了,通过上面的清单不难发现,VB的许多变动是有实际意义的,
也是有明显进步的。

  不过,通过上面这些变动却不能改变一个事实,你许多现有的代码将不会正常运作。

  我们先看个完整的查询的例子,这个例子也显示了当查询显示没有纪录返回和如何检测返回NULL数据的情况

  <%@ OutputCache duration="240"%>
<%--
the above OutputCache directive is pretty slick
It means that for 240 seconds (4 minutes) the page will only read the database once
only the first user hitting it forces a database read
--%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.ADO" %>

  <script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
  Dim DS As DataSet
  Dim MyConnection As ADOConnection
  Dim MyCommand As ADODataSetCommand
  dim strconn as string
  dim strSQL as string

  strconn="DSN=student;uid=student;pwd=magic;database=student"

  strSQL="select * from Publishers where state="NY""

  MyConnection = New ADOConnection(strconn)
  MyCommand = New ADODataSetCommand(strSQL,MyConnection)

  DS = new DataSet()
  MyCommand.FillDataSet(ds, "Publishers")

  MyDataGrid.DataSource=ds.Tables("Publishers").DefaultView
  MyDataGrid.DataBind()
End Sub

</script>
<html><head>
<title>Grid of New York Data</title>
</head>
<body bgcolor="#FFFFFF">
<h3><font face="Verdana">New York Data</font></h3>

<ASP:DataGrid id="MyDataGrid" runat="server"
Width="100%"
BackColor="white"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
Headerstyle-BackColor="lightblue"
Headerstyle-Font-Size="10pt"
Headerstyle-Font-Style="bold"
MaintainState="false"
/>
</body></html>

  C# (C Sharp)

  C # 非常“酷”,这儿有个双关语,在微软的内部代码名称里,C#就被称为 “酷”(具体语法将另文介绍)。如果你
是用VB的开发者,就没有必要换用其它的语言,但是用C++ 的开发者会高兴得不得了。我们将在后面看到关于C#的例子

  Jscript

  如我所知,这也是以前老版本的Jscript。如同VB一样,Jscript也从NGWS runtime中得益不少,并且它也是被编译过的。