Velocity Reviews

Velocity Reviews (
-   ASP .Net (
-   -   using resource manager (

=?Utf-8?B?cHJhc2hhbnQga3VtYXIgc3JpdmFzdGF2YQ==?= 06-12-2007 07:03 AM

using resource manager
Hi all,

I m using 2.0 version and want to retrieve the particular string
from resource file dynamically... Following is the my code ... but in this
every time I get exception that resource key not found... ... might be
possible as i think that resource file which is being loaded is not fund ...
plz suggest me how to find the base name of project so that the resource file
will be loaded .....

using System;
using System.Resources;
using System.Reflection;

namespace ResourcesDemo
/// <summary>
/// Class for resource retrival
/// </summary>
public class ResourceText
private ResourceText()

private static ResourceManager _resourceManager;

//Following method will be called from Global.asax Application_Start

public static void InitializeResources() //
string gg = Assembly.GetExecutingAssembly().FullName;
Assembly assembly = Assembly.GetExecutingAssembly();
_resourceManager = new ResourceManager("ResourcesDemo.TextRes",
_resourceManager.IgnoreCase = true;

public static string GetString(string key)
string gg = Assembly.GetExecutingAssembly().ToString();
string s = _resourceManager.GetString( key );
if( null == s ) throw(new Exception());
return s;
//for resource key not found
return String.Format("[?:{0}]", key);

// resource schema...
<data name="EMPLOYEE">
<value>Are you sure you want to delete this employee?
Doesn't matter it will be deleted any way...</value>
Reply soon …
Thanks for giving me your time

All times are GMT. The time now is 12:27 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.