Solved

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

Posted on 2008-06-16
1
1,431 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 to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

706 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

19 Experts available now in Live!

Get 1:1 Help Now