Solved

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

Posted on 2008-06-16
1
1,459 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

749 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