homepage Welcome to WebmasterWorld Guest from 54.227.182.191
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

    
Keeping Links Intact in Access DB
Color7




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

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




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

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




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

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




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

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




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

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




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

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




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

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




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

Any ideas on this?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved