Getting an URL from an Access db and turning into <a href> link

J

JEFF

Hello,

I am trying to get a URL out of an Access database and make it a link on an
aspx web page. For some reason it looks like this on the page:

#http://mydomain.org#

I have the following AccessDataSource

<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/mydata.mdb"
SelectCommand="SELECT * FROM [Events] WHERE ([ID] = ?) ORDER BY
[starttime]">
<SelectParameters>
<asp:QueryStringParameter Name="ID" QueryStringField="id"
Type="Int32" />
</SelectParameters>
</asp:AccessDataSource>

Here is myFormView item template that contains:

<asp:FormView ID="FormView1" runat="server" DataKeyNames="ID"
DataSourceID="AccessDataSource1">
<ItemTemplate>
<h2><asp:Label ID="titleLabel" runat="server" Text='<%#
Bind("title") %>'></asp:Label></h2><br />
<h3>Description: <asp:Label ID="descriptionLabel" runat="server"
Text='<%# Bind("description") %>'></asp:Label>
</h3><br />
Start Date: <asp:Label ID="starttimeLabel" runat="server"
Text='<%# Bind("starttime","{0:D}") %>'></asp:Label><br />
End Date: <asp:Label ID="endtimeLabel" runat="server"
Text='<%# Bind("endtime","{0:D}") %>'></asp:Label><br />
URL: <asp:Label ID="staticurlLabel" runat="server" Text='<%#
Bind("staticurl") %>'></asp:Label><br />
Location: <asp:Label ID="LocationLabel" runat="server"
Text='<%# Bind("Location") %>'></asp:Label><br />
Image: <asp:Label ID="ImageLabel" runat="server" Text='<%#
Bind("Image") %>'></asp:Label><br />
</ItemTemplate>
</asp:FormView>

Do I have to get the value in some sort of script and then build my own <a
href> link? How can I parse off the # chars?

Thanks in advance!
Jeff
 
N

Nathan Sokalski

Just use the HyperLink control and do the same thing you did with all your
Label controls. Databinding can be used for most controls and properties,
and I know that it can be used for the NavigateUrl property of the HyperLink
control (I have done exactly that before, and I was also using Access). If
it is putting the value inside #'s like you said, doublecheck your syntax
and the value in the database. Your code for the Text properties of the
Labels looks correct, so if you do the same thing for the NavigateUrl
property of the HyperLink you should be good.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top