Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

DataList Hyperlink OnMouseOver

Posted on 2008-10-20
Last Modified: 2013-12-17
I have a datalist with an hyperlink, i assign images dynamically in codebehind, but i need to assign an image onMouseOver, the datasourceID is a Sitemap what I´m doing is this:

<asp:DataList ID="DataList1" runat="server" DataSourceID="SiteMapDataSource1" RepeatDirection="Horizontal"
                        <asp:HyperLink ID="btnMenu" runat="server" Enabled='<%# GetIsDisable(DataBinder.Eval(Container.DataItem, "Description","{0}"),DataBinder.Eval(Container.DataItem, "Url","{0}")) %>'
                            ImageUrl='<%# GetEnabled(DataBinder.Eval(Container.DataItem, "Description","{0}"),DataBinder.Eval(Container.DataItem, "Title","{0}")) %>'
                            NavigateUrl='<%# Eval("Url") %>' onMouseOver='<%# srcMouseOver(DataBinder.Eval(Container.DataItem, "Title","{0}"))%>'></asp:HyperLink>

  public string srcMouseOut(string Title)
        string thisSrc = "";
        string[] menu;
        menu = ConfigurationManager.AppSettings["Menu"].ToString().Split(',');
        if (menu[0] == Title)
            if (Title == "Planning")
                thisSrc = "this.src='http://rgarcia/Apps_Intranet/Abc/Images/Buttons/btn_planning.jpg';";
        return thisSrc;
Question by:hispanicteleservices

Accepted Solution

HeoQue earned 500 total points
ID: 22769440
onMouseOver expects a javascript not an image src as you implements

Author Comment

ID: 22770402
i just solved it changing the hyperlink for an imageButton

 <asp:DataList ID="DataList1" runat="server" DataSourceID="SiteMapDataSource1"   RepeatDirection="Horizontal"  CellPadding="0" ShowFooter="False" ShowHeader="False">
       <asp:ImageButton ID="btnMenu" runat="server" Enabled='<%# GetIsDisable(DataBinder.EvalContainer.DataItem, "Description","{0}"),DataBinder.Eval(Container.DataItem, "Url","{0}")) %>' ImageUrl='<%# GetEnabled(DataBinder.Eval(Container.DataItem, "Description","{0}"),DataBinder.Eval(Container.DataItem, "Title","{0}")) %>'
onMouseOver='<%# srcMouseOver(DataBinder.Eval(Container.DataItem, "Title","{0}")) %>'
onMouseOut='<%# srcMouseOut(DataBinder.Eval(Container.DataItem, "Title","{0}")) %>'
                            PostBackUrl='<%# Eval("Url") %>'></asp:ImageButton>
Thank you for your help

Open in new window


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question