Click here to Skip to main content
15,907,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I have separate datagrid and image control on the page.
I want to display images in the image control once i click or focus on datagrid image column.
I have stored images and some others values in database.
I am able to retrieve the images in the datagrid from database but i want to view image separately on top of datagrid in image control.
Could any one please guide me to solve this. Please...
Posted

hello try like in this link
its a well known and very pretty image viewer for websites.
hope you enjoy it
 
Share this answer
 
you can use jquery for this and add the image address to image control:
if this is your html:
ASP.NET
    <form id="form1" runat="server">
    <div>
<![CDATA[<%--this is your image control that bind the grid image to it--%>]]>
        <img id="Image1" alt="image" />
<![CDATA[<%--You can put your grid in main div and get css class img to your grid images--%>]]>        
<div id="main"><img alt="image" class="img" src="DB.png" /> </div>
    </div>
    </form>

This is the right code for you, put it in your page markup!
JavaScript
<script type="text/javascript">
  $(document).ready(function () {
       $("#main img").mouseenter(function () {
              var url = $(this).attr('src');
              $("#Image1").attr("src", url);
       });
       $("#main img").mouseleave(function () {
              $("#Image1").removeAttr("src");
       });
    }
);
    </script>

this code take the src address from your grid image and add to your image control when mouse enter to image area, and when leave it remove src attribute!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900