Re: Bulletedlist - Databound - Hyperlink
- From: David Longnecker <dlongnecker@xxxxxxxxxxxxxxxx>
- Date: Fri, 20 Apr 2007 13:33:27 +0000 (UTC)
I'm not aware of a way to do this directly with the BulletedList object. I'd recommend using a repeater and a couple of helper functions for parsing out your data. You could probably place a placeHolder control and do this in codebehind a bit cleaner too.
<head runat="server">
<script runat="server">
public string generateUrl(string parameter)
{
return "~/MyPage.aspx?id=" + parameter; }
public string generateTitle(string parameter)
{
return parameter + "'s home page";
}
</script>
</head>
<body>
....
....
<ul>
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
<ItemTemplate>
<li>
<asp:HyperLink ID="hlEntry" runat="server" NavigateUrl='<%# generateUrl(Eval("username").ToString()) %>'
Text='<%# generateTitle(Eval("username").ToString()) %>' />
</li>
</ItemTemplate>
</asp:Repeater>
</ul>
....
....
</body>
HTH.
---
David R. Longnecker
Web Developer
http://blog.tiredstudent.com
Hi!
How do you format the href field of the <a>-tag when you use a
databound BulletedList in Hyperlink mode?
The field in the database contains an ID that I want to use as a
parameter in the url for the Bulletedlists hyperlink tag.
/Håkan
.
- References:
- Bulletedlist - Databound - Hyperlink
- From: Håkan
- Bulletedlist - Databound - Hyperlink
- Prev by Date: Re: Modal dialog question/how-to
- Next by Date: Re: Web site vs Web Application Project
- Previous by thread: Bulletedlist - Databound - Hyperlink
- Next by thread: AJAX Modal Popup disappearance
- Index(es):