Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have this Code
C#
foreach (GridViewRow gr in GridViewTn.Rows)
            {
                HyperLink hp = new HyperLink();
                hp.Text = gr.Cells[1].Text ;
                hp.NavigateUrl = "NarganTnFiles.aspx?Name=" + hp.Text + "-" + gr.Cells[2].Text +  gr.Cells[5].Text;
                gr.Cells[1].Controls.Add(hp);
            }

I want when mouse move above one item show the picture in image?
XML
<asp:Panel ID="Panel4" runat="server" Height="100%" style="margin-right: 0px" Width="100%" Visible="True">
    <table>
        <tr>
            <td>
                <asp:GridView ID="GridViewTn" runat="server" BorderStyle="None" BorderWidth="1px" CellPadding="2"
                              ShowHeader="True" style="text-align: center; margin-right: 0px;" >
                </asp:GridView>
            </td>
            <td style="width: 300px" align="center">
                <asp:Image ID="TnImage" runat="server" ImageAlign="Middle" Height="250" Width="300"/>
            </td>
        </tr>
    </table>
</asp:Panel>
Posted
Updated 10-May-17 5:14am
v2

1 solution

Try like this :
C#
foreach (GridViewRow gr in GridViewTn.Rows)
{
HyperLink hp = new HyperLink();
hp.Text = gr.Cells[1].Text ;

hp.Attributes.Add("onmouseover", "return showImg('img1.jpg');");

hp.Atrributes.Add("onmouseout", "return HideImg('img1.jpg');");

hp.NavigateUrl = "NarganTnFiles.aspx?Name=" + hp.Text + "-" + gr.Cells[2].Text + gr.Cells[5].Text;
gr.Cells[1].Controls.Add(hp);
}


In aspx javascript

<script language="JavaScript" type="text/javascript">

function showImg(imgname)
{
//    show image or panel (In panel load your image) from javascript
}

function HideImg(Imagename)
{
     //    Hide image or panel (In panel load your image) from javascript
}


</script>
 
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