如何在asp.net中显示来自全局资源文件的水印文本 [英] How to show watermark text from global resource files in asp.net

查看:95
本文介绍了如何在asp.net中显示来自全局资源文件的水印文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..
我在我的应用程序中使用TextBoxWatermarkExtender.我需要显示全局资源文件中的水印文本.解决此问题的指南...

Hi..
Im using TextBoxWatermarkExtender for my application. I need to show watermark text from global resource files. Guide to solve this...

推荐答案

这是您要寻找的内容吗?
后面的页面代码:
Is this what you are looking for
Page Code Behind:
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中显示来自全局资源文件的水印文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆