本文介绍了如何在asp.net中显示来自全局资源文件的水印文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨..
我在我的应用程序中使用TextBoxWatermarkExtender.我需要显示全局资源文件中的水印文本.解决此问题的指南...
Hi..
Im using TextBoxWatermarkExtender for my application. I need to show watermark text from global resource files. Guide to solve this...
推荐答案
using System.Threading;
using System.Globalization;
using System.Resources;
ResourceManager rm;
protected void Page_Load(object sender, EventArgs e)
{
initResourceManager();
TextBoxWatermarkExtender.WatermarkText= rm.GetString("ResourceName");
}
private void initResourceManager()
{
Thread.CurrentThread.CurrentCulture = new CultureInfo(Session["Language"].ToString());// provided you have a Session["Language"] with Language value like "en-EN" or "de-DE"
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
rm = (ResourceManager)Application["RM"];
}
Global.asax
Global.asax
using System.Threading;
using System.Globalization;
protected void Application_Start(object sender, EventArgs e)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-EN");
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
Application["RM"] = Resources.ResLanguage.ResourceManager;
}
希望对您有所帮助.
Hope it Helps.
这篇关于如何在asp.net中显示来自全局资源文件的水印文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!