I’m working on an image gallery, where the user can upload images. When an image is upload a message shall be visible for some seconds, which I want to do by making a div visible (for like 5 seconds) with jQuery.
The message shall be visible when an upload has completed, which is done through the method below in my code behind file.
I have a separate JS-file with a method that is called when the page has loaded, but I haven’t got a clue how to call a function from that file when an image is successfully uploaded.
Is it possible to call a specific jQuery method from the code behind method below. Is there a better way to accomplish what I want?
Thanks in advance.
protected void UploadButton_Click1(object sender, EventArgs e) {
if (Page.IsValid) {
if (ImageUpload.HasFile) {
var content = ImageUpload.FileContent;
var name = ImageUpload.FileName;
var image = Gallery.SaveImage(content, name);
fullSizeImage.ImageUrl = "Images/" + image;
// Show message!
}
}
}
Use
ClientScriptManagerto register a startup script.