Hi folks, I added a resource file in my asp.net webforms website and now I want to see the properties to make it "Embedded Resource", but when I right-click on to the resource file, I don't see any 'Properties' Menu there.
I tried adding a new item and added an existing item from another project but still, I can't see this menu. Googled the whole day to overcome this issue but nothing yet.
The requirement is to make this web application bilingual (English and Arabic). I am doing wrong or if there is any easiest way to achieve this, please guide me.
CodePudding user response:
Resources for web based applications are not like desktop ones. When you add a resource, it is placed as a plane jane file in a folder called Resources. it works this way, since then a URL or web based mark-up can see use consume such resources.
However, if you use the project properties and don't use "settings" and do use a resource? (and not a add file or say icon????).
Then in most cases you can get at the resources this way:
TextBox2.Text = Properties.Resources.String1;
However, to pull a image from resources, and shove say into a image control, then you have to do like this:
ImageConverter MyConvert = new ImageConverter();
byte[] ImageBytes = (byte[])MyConvert.ConvertTo(Properties.Resources.horses, typeof(byte[]));
var base64Data = Convert.ToBase64String(ImageBytes);
Image1.ImageUrl = "data:image/png;base64," base64Data;
In above, the image was "horses"