Alex Rivera | Logout

How to use c# code inside <% ... %> tags on asp.net page?

Asked 2009-07-21T10:40:58.490
11

I'm writing an asp.net user control. It has a property, FurtherReadingPage, and two controls bound to it: ObjectDataSource and a Repeater. Inside the Repeater I would like to display a hyperlink with an href property set to something like FurtherReadingPage + "?id=" + Eval("Id"). I don't know how to do it inside the page's markup. I can use <% Eval("Id") %> or <% Response.Write(FurtherReadingPage + "?id=") %> alone but I don't know how to mix them.

Edit
Report

1 Answer

3

Try this:

<%#String.Format("{0}?id={1}",FurtherReadingPage, Id)%>
answered 2009-07-21T10:46:46.963

Your Answer