Solved

How can I create hyperlink in a datalist control in asp.net   ?

Posted on 2008-06-16
1
1,444 Views
Last Modified: 2013-11-07
How can i create a hyperlink to the image in the following datalist   ? thanks


<body>
    <form id="form1" runat="server">
    <div>
       <asp:AccessDataSource ID="AccessDataSource1" runat="server"  DataFile="~/images.mdb"
            SelectCommand="SELECT [ID], [Name], [L] FROM [images]"></asp:AccessDataSource>
        <asp:DataList ID="DataList1" runat="server"   RepeatColumns="5"  DataKeyField="ID" DataSourceID="AccessDataSource1">
            <ItemTemplate>
             
               <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>'></asp:Label><br />
               <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>'></asp:Label><br />
               <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("L") %>' /><br />
               <asp:Button ID="Button1" runat="server" Text="Button" />
                <br />                                
            </ItemTemplate>
        </asp:DataList></div>
       
    </form>
</body>
0
Comment
Question by:ernartey
1 Comment
 
LVL 14

Accepted Solution

by:
ajitha75 earned 500 total points
ID: 21799326
Instead of Image control use Hyperlink control as below

<asp:Hyperlink id="linkToPage" ImageUrl='<%# Eval("L") %>' runat="server" NavigateUrl="Default.aspx"></asp:Hyperlink>
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

911 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

18 Experts available now in Live!

Get 1:1 Help Now