Binding static and dynamic content in HTML

I was binding a link to the NavigateUrl in a repeater, and I found something funny; when I did:

NavigateUrl='item.aspx?id=<%# Eval("ID") %>'

literally renders as:

item.aspx?id=<%# Eval("ID") %>

So if you append the link inside the binding statement as such:

<%# "item.aspx?id=" + Eval("ID").ToString() %>

This will create one fluid url with the field.  Note that I call ToString() because I code with option explicit on; if you do not, this isn't needed, but is more performant if you do (but is probably negligible.
Published Wednesday, August 16, 2006 4:52 PM by bmains
Filed under:

Comments

No Comments

The leading UI suite for ASP.NET - Telerik radControls
Outstanding performance. Full ASP.NET AJAX support. Nearly codeless development.