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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 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