// 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";
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2