Welcome to WebmasterWorld Guest from 54.226.62.26

Forum Moderators: ocean10000

Message Too Old, No Replies

Keeping Links Intact in Access DB

     

Color7

7:28 pm on Nov 18, 2010 (gmt 0)

5+ Year Member



Hi Everyone,

I have an access DB created in Access 2007 and saved in Access 2003 (.mdb). The tables contain links to a file server on my internal network. I'm trying to import the db into Expression Web 4 and keep the links intact. Currently, I can get the import to work, but the links get stripped out and displayed as plain text.


Any ideas?

Thanks.

Ocean10000

4:24 am on Nov 19, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I beleive the hyperlink field you are talking about is treated as a string value via data access objects, and would come out as a simple plain text. You will have to just create the hyperlink in the Asp.net code using this plain string in the href value.


Example without data binding to keep it easy to read where "value" is the hyperlink text from the database
<a href="<%=value%>"><%=value%></a>

Color7

6:08 pm on Nov 19, 2010 (gmt 0)

5+ Year Member



Hi Ocean1000,

I'm new to .Net, so I apologize in advance for any ignortant questions. :) Here is what my code looks like so far:

<asp:DataList id="DataList1" runat="server" CellPadding="4" DataSourceID="AccessDataSource1" ForeColor="#333333" RepeatColumns="1">
<AlternatingItemStyle BackColor="White" />
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<ItemStyle BackColor="#E3EAEB" />
<ItemTemplate>
<asp:Label id="LogosLabel" runat="server" Text='<%# Eval("Logos") %>' />
&nbsp;&nbsp;&nbsp;
<asp:Label id="DownloadLabel" runat="server" Text='<%# <a href="<%=Download%>"<%=Download%></a> %' />
<br />
<br />
</ItemTemplate>
<SelectedItemStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
</asp:DataList>
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="Marketing-Files.mdb" SelectCommand="SELECT [Logos], [Download] FROM [Logos]">
</asp:AccessDataSource>



This Produces a column with 1 field and a column with =%

So, it looks like this:

Logo 1 =%

The desired result would be:

Logo 1 DOWNLOAD (where DOWNLOAD is a hyperlink)

Thanks for your help!

Ocean10000

6:38 pm on Nov 19, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I think this is what you are trying to achieve.

<ItemTemplate>
<asp:Image runat="server" ImageUrl='<%# Eval("Logos") %>' />
&nbsp;&nbsp;&nbsp;
<asp:HyperLink runat="server"
NavigateUrl='<%# Eval("Download", "{0}") %>' Text='Download'></asp:HyperLink>
<br />
<br />
</ItemTemplate>

Color7

6:55 pm on Nov 19, 2010 (gmt 0)

5+ Year Member



I think we're getting closer.

The code above includes an image. I'd just like to pull text from my db in that column. ie. Logo 1 (followed by the download link.)

The hyperlink is pointing here:

Download%20Now#http://Download%20Now#

How do I define the link from the db?

Thanks!

Color7

9:57 pm on Nov 19, 2010 (gmt 0)

5+ Year Member



ok, I noticed I had an error in my Access db that was causing the URL to display incorrectly. After fixing the error, I'm now getting a double URL. ie:

\\MyServer\Files\Subfolder\downloads\Logos\MyLogo.ai#//MyServer/Files/Subfolder/downloads/Logos/MyLogo.ai#

Color7

10:08 pm on Nov 19, 2010 (gmt 0)

5+ Year Member



And to fix the image issue described above I just replaced the image code with:

<asp:Label id="LogosLabel" runat="server" Text='<%# Eval("Logos") %>' />

Everything is working great except for the double URL.

Any ideas on that one?

Color7

12:02 am on Nov 30, 2010 (gmt 0)

5+ Year Member



Any ideas on this?
 

Featured Threads

Hot Threads This Week

Hot Threads This Month