// The following function is designed to insert an image into the WebImageViewer on // the client side at a specific index. This will cause the WebImageViewer // ImageItemInserted client side event to fire function insertImage() { var iv = $find("WebImageViewer1"); var items = iv.get_items(); var item = items.createItem(); item.set_imageUrl("~/images/TestImage.jpg"); items.insert(3, item); } // The client side event ImageItemInserted takes two parameters, sender and e. // Sender is the object which is raising the event // e is the ImageViewerEventArgs function WebImageViewer_ImageItemInserted(sender, e) { var imageviewer = $find("WebImageViewer1"); // Returns the ImageItem associated with the event var imageItem = e.getImageItem(); // Get the index of the new image var imageIndex = imageItem.get_index(); // Determines if the image is visible within the image viewer, returns // boolean var visible = imageItem.isVisible(); // Set alt text of the new image imageItem.set_altText("New Image Inserted at Index: "+imageIndex); }
Me.WebImageViewer1.ClientEvents.ImageItemInserted = "WebImageViewer_ImageItemInserted"
this.WebImageViewer1.ClientEvents.ImageItemInserted = "WebImageViewer_ImageItemInserted";