// The following function is designed to add an image to the WebImageViewer on // the client side. This will cause the WebImageViewer ImageItemAdded client // side event to fire function addImage() { var iv = $find("WebImageViewer1"); var items = iv.get_items(); var item = items.createItem(); item.set_imageUrl("~/images/TestImage.jpg"); items.add(item); } //The client side event ImageItemAdded takes two parameters, sender and e. //Sender is the object which is raising the event //e is the ImageViewerEventArgs function WebImageViewer_ImageItemAdded(sender, e) { var imageviewer = $find("WebImageViewer1"); // Returns the ImageItem associated with the event var imageItem = e.getImageItem(); // Set the added image to be visible in the image viewer imageItem.set_visible(true); // Get the index of the new image var imageIndex = imageItem.get_index(); // Set alt text of the new image imageItem.set_altText("New Image Added at Index: "+imageIndex); }
Me.WebImageViewer1.ClientEvents.ImageItemAdded = "WebImageViewer_ImageItemAdded"
this.WebImageViewer1.ClientEvents.ImageItemAdded = "WebImageViewer_ImageItemAdded";