Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

DataList Hyperlink OnMouseOver

Posted on 2008-10-20
2
Medium Priority
?
2,191 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
2 Comments
 
LVL 9

Accepted Solution

by:
HeoQue earned 1500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

773 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