Solved

DataList Hyperlink OnMouseOver

Posted on 2008-10-20
2
2,137 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 500 total points
Comment Utility
onMouseOver expects a javascript not an image src as you implements
http://www.w3schools.com/jsref/jsref_onmouseover.asp
0
 

Author Comment

by:hispanicteleservices
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now