Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

database connection with hyperlinks

Status
Not open for further replies.

zoidberg84

Programmer
Joined
Feb 21, 2006
Messages
9
Location
GB
hello all, i am using Microsoft Access 2003 and ASP.net as my language and i have made a connection to my database but inside the database is a table called picture, with a field called Pic_File, Pic_File has an address for a location of the picture (which i have set as a hyperlink)!

my problem is that i can get the address to display on my web page but i dont know how to actually make it a hyperlink to show that picture!?

here is my code to make the connection and display the results:
Code:
<asp:GridView ID="Gridview1" runat="server" AutoGenerateColumns="false" BackColor="#FFFF99" BorderColor="black" BorderStyle="Solid" BorderWidth="1px" Width="100%" DataKeyNames="ID" DataSourceID="SqlDataSource1" AllowSorting="true" AllowPaging="true">
    <HeaderStyle HorizontalAlign="Left" />
    <Columns>
        <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" />
        <asp:BoundField DataField="Pic_Name" HeaderText="Picture name" SortExpression="Pic_Name" />
        <asp:BoundField DataField="Pic_File" HeaderText="File name" />
    </Columns>
</asp:GridView>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:db1ConnectString %>" 
                   ProviderName="<%$ ConnectionStrings:db1ConnectString.ProviderName %>" SelectCommand="SELECT * FROM picture">
</asp:SqlDataSource>

I ideally want to hide the actual hyperlink and replace it with some text (eg. cheese picture) but use the hyperlink to access the picture!

cheers for any help
 
Rather than use a BoundField, use a template column and drop a HyperLink control into it


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
a template column?? cool, I'll look into it! never used it before so any advice it would be great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top