473,799 Members | 2,988 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to enlarge image on mouseover in gridview

40 New Member
hi;

Im using a gridview to display images in 1 of the column...but the size of the images is very small.is there anyway to enlarge the image on mouseover or even without mouseover by adjusting the column width or something.i would prefer doing it by mouseover.can anybody help me...my code is below

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="news_evnts.aspx.cs" Inherits="news_evnts" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head>
  6.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7.     <title>Prison Department, Goa</title>
  8.     <link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />
  9.  
  10.     <script language="javascript" type="text/javascript">
  11.     function txtChk(){txtChanged('u'); txtChanged('p');}
  12.         function txtChanged(s){if(s=='u'){if(document.getElementById("txtEmail").value=="" || document.getElementById("txtEmail").value=="Login Id"){document.getElementById("txtEmail").value="Login Id";    document.getElementById("txtEmail").style.color="#aca899";}}
  13.         else if (s=='p') {if(document.getElementById("txtPass").value=="" || document.getElementById("txtPass").value=="Password"){document.getElementById("txtPass").value="Password";document.getElementById("txtPass").style.color="#aca899";}}}
  14.         function txtClick(s){if(s=='u'){if(document.getElementById("txtEmail").value=="Login Id"){    document.getElementById("txtEmail").value="";document.getElementById("txtEmail").style.color="#000000";    }}
  15.         else if(s=='p'){if(document.getElementById("txtPass").value=="Password"){    document.getElementById("txtPass").value="";document.getElementById("txtPass").style.color="#808080";}}}
  16.  
  17.  
  18.             var lastColorUsed, colUsed;
  19.  
  20.             function dg_changeBackColor(row, highlight)
  21.             {
  22.                 if (highlight)
  23.                 {
  24.                     lastColorUsed = row.style.backgroundColor;
  25.                     colUsed =  row.style.color;
  26.  
  27.                     row.style.backgroundColor ='DimGray';//"#F7F7F7";// 'papayawhip';
  28.                     row.style.color = 'Blue';
  29.                     row.style.cursor='hand';
  30.                 }
  31.                 else
  32.                 {            
  33.                     row.style.backgroundColor = lastColorUsed;
  34.                     row.style.color = colUsed;
  35.                 }
  36.             }
  37.  
  38.             function stopPost()
  39.             {
  40.                 return false;
  41.             }
  42.  
  43.  
  44.  
  45.     </script>
  46.  
  47.     <script language="JavaScript" type="text/javascript">
  48.             var newBg;
  49.             function changeHl(strId)
  50.             {
  51.                newBg = "images/HlImg/"+strId+".jpg";
  52.                document.getElementById("imgHL").src = newBg;          
  53.             }
  54.             function setURL()
  55.             {
  56.            var param = "height="+screen.height+",width="+screen.width+",resizable=yes,status=yes,toolbar=no,menubar=no,screenX=0,screenY=0,left=0,top=0";
  57.                var s =  document.getElementById("ctl00_txtFilePath").value ;    
  58.               window.open(s,"citizenchart",param);
  59.  
  60.             }
  61.     </script>
  62.  
  63. </head>
  64. <body>
  65.     <form id="mst" runat="server">
  66.         <div id="wrapper">
  67.             <div id="header">
  68.                 <div style="color: #FFFFFF; font-family: 'Maiandra GD', 'Trebuchet MS', Tahoma, Verdana;">
  69.                     <table id="tbl" width="100%">
  70.                         <tr>
  71.                             <td align="center" style="width: 145px">
  72.                                 <img src="images/bg_charity1.jpg" alt="gov" style="width: 76px; height: 84px" /></td>
  73.                             <td>
  74.                                 <div style="font-size: 24px;">
  75.                                     Inspector General of Prisons</div>
  76.                                 <div style="font-size: 16px;">
  77.                                     Government of Goa</div>
  78.                             </td>
  79.                         </tr>
  80.                     </table>
  81.                 </div>
  82.                 <div id="navlist">
  83.                     <ul id="Ul1">
  84.                         <li><a id="hm" runat="server" href="index.aspx">Home</a></li>
  85.                         <%--<li><a id="hm" href="index.html">Home</a></li>--%>
  86.                         <li><a id="au" runat="server" href="AboutUs.aspx">About Us</a></li>
  87.                         <li><a id="am" runat="server" href="Amenities.aspx">Amenities</a></li>
  88.                         <li><a id="ne" runat="server" href="news_evnts.aspx">News & Events</a></li>
  89.                         <li><a id="pr" runat="server" href="jailproducts.aspx">Products</a></li>
  90.                         <li><a id="rti" runat="server" href="rghtoinfrmtn.aspx">R. T. I.</a></li>
  91.                         <li><a id="cc" runat="server" href="remission.aspx">Remission</a></li>
  92.                         <li><a id="fb" runat="server" href="Default2.aspx">Feedback</a></li>
  93.                         <li><a id="cu" runat="server" href="contact.aspx">Contact Us</a></li>
  94.                     </ul>
  95.                 </div>
  96.             </div>
  97.             <div id="headline">
  98.                 <div id="photo">
  99.                     <div>
  100.                         <img src="images/igp.gif" width="618" height="250" alt="Pic 1" />
  101.                     </div>
  102.                 </div>
  103.                 <div id="search-news" style="height: 248px">
  104.                     <h2 class="downcast">
  105.                         Quick Links</h2>
  106.                     <br />
  107.                     <div id="plussbullets">
  108.                         <asp:HiddenField ID="txtFilePath" runat="server" />
  109.                         <%--    <asp:TextBox ID="txtFilePath" runat="server" Width="71px"  ></asp:TextBox>--%>
  110.                         <ul>
  111.                             <%--  <li> <asp:LinkButton ID="lbStats" runat="server" OnClick="stats_Click" >Prison Statistics</asp:LinkButton></li>--%>
  112.                             <%--<li><asp:HyperLink ID="HyperLink1" runat="server"  OnClick="stats_Click">Prison Statistics</asp:HyperLink></li>--%>
  113.                             <%-- <li><a href="" onclick="stats_Click">
  114.                               Prison Statistics  </a></li>--%>
  115.                             <li><a id="A1" href="" runat="server" onclick="setURL();" target="_blank">Prison Statistics</a></li>
  116.                             <li><a href="rightsandduties.aspx">Rights & Duties of Prisoners</a></li>
  117.                             <li><a href="reformation.aspx">Jail Reformation</a></li>
  118.                             <li><a href="Citizen_new.pdf" target="_blank">Citizen's Charter</a></li>
  119.                             <li><a href="listaddoff.aspx">List of area wise offices and Judicial Lock-Ups</a></li>
  120.                             <li><a href="orgchart.aspx">Organisational Setup</a></li>
  121.                         </ul>
  122.                     </div>
  123.                 </div>
  124.                 <div class="clear">
  125.                 </div>
  126.             </div>
  127.             <div id="body">
  128.                 <div class="info">
  129.                     News and Events</div>
  130.                 <br />
  131.                 <div id="body-left">
  132.                     <div style="height: 270px; width: 163px; overflow: Auto">
  133.                         <asp:DataList ID="dlEvents" runat="server" Width="90%" GridLines="both" CellPadding="5"
  134.                             OnItemCommand="getSelected" DataKeyField="prison_event_title">
  135.                             <%--OnItemDataBound="ItemDataBound"OnSelectedIndexChanged="SelectedIndexChanged"--%>
  136.                             <HeaderStyle BackColor="#5C5C5C" BorderColor="#859D31" BorderStyle="solid" BorderWidth="1px"
  137.                                 Font-Names="Tahoma, Verdana, sans-serif" Font-Bold="true" Font-Size="11px" ForeColor="white" />
  138.                             <SelectedItemStyle BackColor="white" ForeColor="#99A866" />
  139.                             <HeaderTemplate>
  140.                                 Titles
  141.                             </HeaderTemplate>
  142.                             <ItemTemplate>
  143.                                 <asp:LinkButton ID="Linkbutton1" runat="server" CommandName="select" Text='<%# Bind("prison_event_title") %>' />
  144.                             </ItemTemplate>
  145.                             <ItemStyle BackColor="white" ForeColor="#99A866" />
  146.                         </asp:DataList>
  147.                     </div>
  148.                 </div>
  149.                 <div id="body-right" style="width: 351px">
  150.                     <%-- <asp:DataList ID="dlEvntImages" runat="server" Visible="false">
  151.  
  152.                         <ItemTemplate>
  153.                     <asp:Image runat="server" ID="evntImage">
  154.                         </asp:Image>
  155.  
  156.                             <asp:Label ID="lblMsg" runat="server"  Text='<%# Bind("prison_eventDtl_description") %>'></asp:Label>
  157.                                <asp:Label ID="lblId" runat="server" Visible="false" Text='<%# Bind("prison_event_id") %>'></asp:Label>
  158.                                   <asp:Label ID="lblKey" runat="server" Visible="false" Text='<%# Bind("prison_eventDtl_srno") %>'></asp:Label>
  159.                     </ItemTemplate>
  160.                     </asp:DataList>--%>
  161.                     <table id="tblEvntDetails" runat="server" border="1" visible="false">
  162.                         <tr>
  163.                             <td>
  164.                             </td>
  165.                             <td>
  166.                                 <div style="height: 200px; overflow: auto;">
  167.                                     <asp:GridView ID="gvDocuments" runat="server" HorizontalAlign="Left" Width="98%"
  168.                                         EmptyDataText="No records found" AutoGenerateColumns="False" BackColor="White"
  169.                                         BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="1" ForeColor="Black"
  170.                                         Height="18px">
  171.                                         <Columns>
  172.                                             <asp:TemplateField HeaderText="Event Id" Visible="False">
  173.                                                 <ItemTemplate>
  174.                                                     <asp:Label ID="gvLblId" runat="server" Text='<%# Bind("prison_event_id") %>'></asp:Label>
  175.                                                 </ItemTemplate>
  176.                                             </asp:TemplateField>
  177.                                             <asp:TemplateField HeaderText="Image Id" Visible="False">
  178.                                                 <ItemTemplate>
  179.                                                     <asp:Label ID="gvLblSrNo" runat="server" Text='<%# Bind("prison_eventDtl_srno") %>'></asp:Label>
  180.                                                 </ItemTemplate>
  181.                                             </asp:TemplateField>
  182.                                             <asp:TemplateField HeaderText="Image">
  183.                                                 <ItemTemplate>
  184.                                                     <asp:Image ID="Image1" Height="40" Width="40" runat="server" ImageUrl='<%# "~/ASHX/ImageHandler.ashx?__KEY="+ Eval("prison_event_id")+"&__imgId="+Eval("prison_eventDtl_srno") %>' />
  185.                                                 </ItemTemplate>
  186.                                                 <HeaderStyle HorizontalAlign="Center" />
  187.                                                 <ItemStyle Height="200px" Width="200px" />
  188.                                             </asp:TemplateField>
  189.                                             <asp:TemplateField HeaderText="Description">
  190.                                                 <ItemTemplate>
  191.                                                     <asp:Label ID="lblDesc" runat="server" Text='<%# Bind("prison_eventDtl_description") %>'
  192.                                                         Width="200px"></asp:Label>
  193.                                                 </ItemTemplate>
  194.                                                 <HeaderStyle HorizontalAlign="Center" />
  195.                                                 <ItemStyle Height="200px" Width="400px" />
  196.                                             </asp:TemplateField>
  197.                                         </Columns>
  198.                                         <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
  199.                                         <SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
  200.                                         <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
  201.                                         <AlternatingRowStyle BackColor="White" />
  202.                                         <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
  203.                                     </asp:GridView>
  204.                                 </div>
  205.                             </td>
  206.                         </tr>
  207.                         <tr>
  208.                             <td colspan="1">
  209.                                 <asp:Label ID="lblTitle" runat="server" Text="Title" Visible="false" Font-Bold="true"></asp:Label></td>
  210.                             <td colspan="3">
  211.                                 <asp:Label ID="lblEvntTitle" runat="server" Text='<%# Eval("prison_event_title") %>'
  212.                                     Visible="false"></asp:Label></td>
  213.                         </tr>
  214.                         <tr>
  215.                             <td>
  216.                                 <asp:Label ID="lblEvntId" runat="server" Text='<%# Eval("prison_event_id") %>' Visible="false"></asp:Label></td>
  217.                         </tr>
  218.                         <tr>
  219.                             <td colspan="1">
  220.                                 <asp:Label ID="lblDate" runat="server" Text="Date" Visible="false" Font-Bold="true"></asp:Label></td>
  221.                             <td colspan="4">
  222.                                 <asp:Label ID="lblEvntDate" runat="server" Text='<%# Eval("prison_event_date") %>'
  223.                                     Visible="false"></asp:Label></td>
  224.                         </tr>
  225.                         <tr>
  226.                             <td colspan="1">
  227.                                 <asp:Label ID="lblVenue" runat="server" Text="Venue" Visible="false" Font-Bold="true"></asp:Label></td>
  228.                             <td colspan="4">
  229.                                 <asp:Label ID="lblEvntVenue" runat="server" Text='<%# Eval("prison_event_venue") %>'
  230.                                     Visible="false"></asp:Label></td>
  231.                         </tr>
  232.                         <tr>
  233.                             <td colspan="1">
  234.                                 <asp:Label ID="lblDesc" runat="server" Text="Description" Visible="false" Font-Bold="true"></asp:Label></td>
  235.                             <td colspan="4">
  236.                                 <div style="height: 50px; overflow: auto;">
  237.                                     <asp:Label ID="lblEvntDesc" runat="server" Text='<%# Eval("prison_event_description") %>'></asp:Label>
  238.                                     <%--<asp:TextBox ID="txtEvntDesc" runat="server" Text='<%# Eval("prison_event_description") %>'
  239.                                     ReadOnly="true" Visible="false"></asp:TextBox>--%>
  240.                                 </div>
  241.                             </td>
  242.                         </tr>
  243.                     </table>
  244.                 </div>
  245.             </div>
  246.             &nbsp;
  247.             <p>
  248.             </p>
  249.             <div class="clear">
  250.             </div>
  251.         </div>
  252.         <div id="footer">
  253.             <p>
  254.                 &copy; 2009 all rights reserved.</p>
  255.             <p>
  256.                 Developed &amp; Maintained by Goa Electronics Limited
  257.             </p>
  258.             <p>
  259.                 www.goaelectronics.co.in</p>
  260.         </div>
  261.     </form>
  262. </body>
  263. </html>
  264.  
May 24 '10 #1
1 4663
Frinavale
9,735 Recognized Expert Moderator Expert
No where in your code (that I can see) do you have any JavaScript that handles the mouseover event. You need to implement a method that does so.

If you don't want the image resize to have an effect on your column width then, in the method that handles the mouseover event for the image, set the image's position to "absolute". This will remove the image from the natural flow of the page so that when you resize it, the column will not be affected.

-Frinny
May 27 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
13457
by: John | last post by:
Imagine this: I have a gif-image with text, coloured green. When MouseOver occurs the gif will swap to another gif with red colourded text. On MouseOut the gif turns back to the green text. -----------------This is my code: <a href="nextpage.html" onMouseOver="document.green.src='red.gif'" onMouseOut="document.green.src='green.gif'">
8
38797
by: PhilM | last post by:
Having googled myself silly, I now ask, if only to confirm my conclusions Is it possible to emulate the <javascript>mouseover in css, to replace link images with an alternate? Having asked, I now return to google, in case I missed heaps. ;) Regards, PhilM
1
5888
by: Tan | last post by:
Hi I am desperate for any help with display image in Gridview I have a gridview contain surname , forename ..... and image. I could not display image as my database store the column image as image not text. I have tried all sort of things like converting the columns image to tempate so on and still could display image
2
3649
by: manmit.walia | last post by:
Hello Fellow Developers, I have a small problem that you might be able to help me with. The method that I am trying to create is the ability to export a GridView and a image to word or excel. I know that some people have already post about this topic but could not find a reliable answer. To my knowledge, I have the code down right. The GridView writes to the word document perfectly just not the image. All I get is a red 'x' image...
1
8197
by: staeri | last post by:
I want to display a background image in the header of my GridView but when I do that by setting HeaderImageUrl="..." the HeaderText isn't visible. It seems to me that either I can show the HeaderText and no background image or vice versa. Is there a solution? Regards,
0
1773
by: =?Utf-8?B?SGFyZHkgV2FuZw==?= | last post by:
Hi all, I am building a web site with theme support, under each theme's folder there are some images. Some of my images need to be skinned, I know I can build a skin file with line like <asp:Image runat="server" ImageUrl="images/email.gif" skinid="Email" BorderWidth="0" /> Then in my master page or web page I can call this skin like
3
1466
by: aSoundMind | last post by:
Hello Guys, I am not sure is this a common problem. I can't display image which in a gridview to excel or word. I have not try on pdf or web but surely this annoy me. I tried to google it and the best I can found is this code which mentioned something tat it is due to excel limitation and so we need to use absolute path.
4
1783
by: ericjiii | last post by:
Hi. A friend of mine asked me if I could look at one of his java scripts in order to get it working. Unfortunately I am stumped and was wondeirng if somebody with a bit more experience than myself can look it over and help me identify what is wrong . <script LANGUAGE="JavaScript"> <!-- Begin image10 = new Image(); var imageDir = "http://2005.rock103.com/pages/bod/thong/"; var d = new Date()
4
3543
by: sourapple77 | last post by:
hi, I'm using flash button like "zoom in" to enlarge an image from html using javaScript. How can I do this? ex. I have flash media inserted within html document and once the button inside the flash is pressed viewers can view the enlarged image from their page. thank you in advance.
0
9540
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10250
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10222
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10026
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9068
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7564
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.