hi,
I have an image added a App_GlobalResources folder. How do i load this image to my image control (dynamically)?
TY
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kirtan PatelPosted Oct 26, 2009, 7:42 AM
These folders are protected from HTTP download, because are supposed to be used server side only
For example, the App_GlobalResources folder is used to contain resources
files (.resx) that are automatically compiled into typed classes, that are
accessible from all Pages of your site.
So, you should use another folder to place your images
check "Do you like this answer" if it helped you :)
Kirtan PatelPosted Oct 26, 2009, 3:54 PM
If still you want to learn how to Upload Image to Image Folder and then Show it In Image Control Here is Code for you
protected void btnUpload_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile == true)
{
//Get Just FileName not Full path of File
string FileName = FileUpload1.FileName;
//Get Actual Path of Images Folder on Server
string FolderPathToSave = Server.MapPath("images");
//Save Image in Images Folder
FileUpload1.SaveAs(FolderPathToSave+@"\"+FileName);
string PathToStoreInDatabase = @"~\images\" + FileName;
// Insert PathToStoreDatabase in Database to Retrive Image Path Again When you need From Database
//Like If you want to Show Uploaded Image in Picture Control Then Code below
Image1.ImageUrl = PathToStoreInDatabase;
}
}
Kirtan PatelPosted Oct 26, 2009, 8:23 AM
There is no Image Property Available in Image Control of Asp.net you just have one way thats to assign path it will be assigned to image but ImageControl Will not show the image thats in App_GlobalResources
normally App_GlobalResources are used to store Globalization Files ie (Resources for Multilaguale Site ) like en-Us.resx etc ..
:)
Nilanka DharmadasaPosted Oct 26, 2009, 7:54 AM
Here I assume that you have added your image as a resource to the project.
If my answer helps you please accept my answer. :)
petre ricardoPosted Oct 26, 2009, 6:44 AM
TY
Venkatesh EllurPosted Oct 26, 2009, 6:30 AM
for example if you want to load the image on click of a button try setting up the property on the button click event.