Solved

DataList Hyperlink OnMouseOver

Posted on 2008-10-20
2
2,173 Views
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"
                    CellPadding="0">
                    <ItemTemplate>
                        <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>
                    </ItemTemplate>
                </asp:DataList>

  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;
    }
0
Comment
Question by:hispanicteleservices
[X]
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
2 Comments
 
LVL 9

Accepted Solution

by:
HeoQue earned 500 total points
ID: 22769440
onMouseOver expects a javascript not an image src as you implements
http://www.w3schools.com/jsref/jsref_onmouseover.asp
0
 

Author Comment

by:hispanicteleservices
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">
<ItemTemplate>
       <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>
</ItemTemplate>
</asp:DataList>
 
Thank you for your help

Open in new window

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

626 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