易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.NET MVC 多语言解决方案

ASP.NET MVC 多语言解决方案()
  就一个网站的多语言特性来说,我认为分为两个方面:
    1、HTML界面上显示的文字需要多语言
    2、HTML界面上JS输出的文字需要多语言
    原来在HTML部分直接写的文字都不能直接写要输出的文字,而是要采用标记的方法来替换。JS也是同理。
    那么在MVC下怎么能透明的实现多语言呢?所谓透明的实现是指,程序员在开发程序当中,不需要过多的考虑多语言的问题,直接调用一个方法就能实现多语言,而且所要用到的语言文件每个语言一个文件就够了,集中翻译这个语言就完成了多语言的功能。
   
   例如
   <html>
  
   <head>
  
   </head>
  
   <body>
  
   多语言输出的文字 //这里就不能直接写中文了,一个好方法是 直接用 <%= Html.Lang("string1") %> 来进行输出
  
   </body>
  
   </html>
  
   这里<%= Html.Lang("clickme") %> 是对 HTMLHelper 进行了扩展,增加了一个 Lang 的方法,参数是需要翻译的资源字符串的Name。
  
   怎么为 HTMLHelper 进行扩展?下面这个类就是增加了的扩展类
Code
   using System;
   using System.Data;
   using System.Configuration;
   using System.Linq;
   using System.Web;
   using System.Web.Security;
   using System.Web.UI;
   using System.Web.UI.HtmlControls;
   using System.Web.UI.WebControls;
   using System.Web.UI.WebControls.WebParts;
   using System.Xml.Linq;
   using System.Globalization;
  
   using System.Web.Compilation;
   using System.Web.Mvc;
   using System.Web.Routing;
  
   namespace System.Web.Mvc {
   public static class LocalizationHelpers {
   /// <summary>


相关文档:

asp.net 验证码 实现

第1种.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing ......

在asp.net 2.0中使用SqlBulkCopy类迁移数据

我们经常要在一个表中将数据迁移到另一个表,当然,用的方法十分多了。在.net 2.0中,提供了一个sqlbulkcopy类,也可以实现如下的操作,下面简单介绍下。比如一个表如下
CREATE TABLE Person3
(
PersonID int IDENTITY(1,1) PRIMARY KEY,
Name nvarchar(200),
Email nvarchar(200),
Picture image
)
INSERT INT ......

什么是Asp.Net应用程序

ASP.NET defines an application as the sum of all files, pages, handlers, modules, and executable code that can be invoked or run in the scope of a given virtual directory (and its subdirectories) on a Web application server. For example, an "order" application might be published in the "/order" virt ......

将Asp.net页面输出为HTML

WebRequest mywebrq;
WebResponse mywebresp;
StreamReader sr;
Streamwriter sw;
Private void Page_Load(object sender,EventArgs e) { mywebreq=WebRequest.Create( http://localhost/Test.aspx ); mywebresp=mywebreq.GetResponse();
sr=new streamReader(mywebresp.GetResponsestream());
strHtml=sr.ReadT ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号