2013-10-19 24 views
1

我推薦This Link1how to use kannada font in asp.net? 但我無法在我的頁面中使用卡納達語。我想在文本框中輸入卡納達語。 Kannada text Box 但它沒有發生......任何人都可以告訴我可能是什麼原因?如何將地區語言添加到我們的網頁?

我的源代碼是在這裏: forKannada.css文件

@font-face {font-family:RaghuKannada; 
src: url('http://www.cdacmumbai.in/projects/indix/RaghuFonts/RORaghuKannada.ttf');} 

home.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Home.aspx.cs" nherits="Home" Culture="kn-IN" UICulture="kn-IN" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//kn-IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" lang="kn"> 
<head runat="server"> 
<title></title> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<link href="../CSS/forKannada.css" rel="stylesheet" type="text/css" />  
</head> 
<body> 
<form id="form1" runat="server"> 
&nbsp;<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> 
<br /> 
<br /> 
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label> 
&nbsp; 
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 
<br />  
<br /> 
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Kannada"Font-Names="Tunga" /> 
&nbsp; 
</form> 

</body> 
</html> 

Home.aspx.cs文件

public partial class Home : System.Web.UI.Page 
{ 
ResourceManager rm; 
CultureInfo ci; 
static bool lkannda = false; 
protected void Page_Load(object sender, EventArgs e) 
{ 
if (!IsPostBack) 
{ 
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); 
rm = new  ResourceManager("Resources.Strings",System.Reflection.Assembly.Load("App_GlobalResources"))  ; 
ci = Thread.CurrentThread.CurrentCulture; 
LoadString(ci); 
} 
else 
{ 
rm = new  ResourceManager("Resources.Strings",System.Reflection.Assembly.Load("App_GlobalResources")); 
ci =Thread.CurrentThread.CurrentCulture; 
LoadString(ci); 
} 
} 
private void LoadString(CultureInfo ci) 
{ 
Label1.Text = rm.GetString("Name", ci); 
Label2.Text = rm.GetString("Desc", ci); 
Button1.Text = rm.GetString("AboutMe", ci); 
} 
protected void Button1_Click(object sender, EventArgs e) 
{ 
if(lkannda) 
{ 
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); 
LoadString(Thread.CurrentThread.CurrentCulture); 
lkannda = false; 
} 
else 
{ 
Thread.CurrentThread.CurrentCulture = new CultureInfo("kn-IN"); 
LoadString(Thread.CurrentThread.CurrentCulture); 
lkannda = true; 
} 
} 
} 

和我創建了2個資源文件一個用於kannada,另一個用於英文,名稱爲Strings.kn-IN.resx和Strings.resx

任何人都可以告訴我這段代碼有什麼錯誤。以及如何在文本框中鍵入kannada作爲圖像顯示?還有什麼我需要爲此代碼添加?

+0

你在所有的瀏覽器或特定的問題都有同樣的問題嗎? –

+0

@codingstill我正在嘗試使用IE,Mozilla Firefox和谷歌瀏覽器。同樣的問題,我正面臨着......我正在使用visual studio 2010。 – Raghuveera

回答

2

對於記錄用戶輸入卡納達語,你通過使用google website Translator它轉換上飛你的頁面描述here

也可以擺脫的資源文件可以創建自定義文本框控件。你只需要設置默認語言爲卡納達

相關問題