hi,
How to swap images in webimageviewer to a aspImage control? I know how to do it in the selected index change event in the code behind..But i want it to happen in the click of webimageviewer without making a full page refresh either using a javescript or using AJAX .How can i do it? one more thing is that my webimageviewer control is in a content page .. pls help me out...
thanks in advance...
That's a really good idea for a sample, I will escalate that to our UXG team. Meanwhile, I've played a bit and was able to achieve something that can get the job done. The idea is to take advantage of the ImageClick client-side event and use the eventArgs to get to the url of the image clicked. You can then use the url to set the url of the asp:Image placeholder. Example:
<cc1:WebImageViewer ID="WebImageViewer1" runat="server" Height="150px" Width="500px"> <ClientEvents ImageClick="copyImage" /> </cc1:WebImageViewer> <asp:Image runat="server" ID="Image1" /> <script type="text/javascript"> function copyImage(sender, eventArgs) { var imagePlaceholder = document.getElementById("<%= Image1.ClientID %>"); var imageClickedUrl = eventArgs.getImageItem().get_imageUrl(); imagePlaceholder.src = imageClickedUrl; } </script>
More info on CSOM (client-side object model) can be found in the online help documentation.
Hope this helps.
very thanks 4 ur reply...
could u pls give any sample code by which if a user clicks in the webimageviewer , it wil come to the asp:image control , using either CSOM or AJAX... as i couldn't find any sample code or if u provide any sample links where i could find some sample code...
once agian thanks
Hello,
Thanks for your interest in WebImageViewer and for your question. I personally believe that there are two possible approaches for solving this problem:
1) You can use the client-side (CSOM) object model of WebImageViewer, and the set_ImageUrl property in particular to set the Url of a particular image item to something else. I believe a good starting point is to check out the CSOM section of the WebImageViewer control - there is plenty of great content there to get you started.
2) You can place the WebImageViewer instance inside an UpdatePanel and use the sever side click event to change the image there. The asp:UpdatePanel will take care of "ajaxifying" the WebImageViewer so end users will not experience a postback refresh effect.