tags:

views:

92

answers:

5

Total noob question here, but not finding the answer via search.

What is the method equivalant of <%= expression %>?

I'm looking to replace this:

<%
 foreach (var intem in IE) {
%>
  <%= Ajax.ActionLink(item,...) %>
<% } %>

with:

<%
 foreach (var intem in IE) {
    SomeOutputCall(Ajax.ActionLink(item,...));
} 
%>
+10  A: 

I guess good old Response.Write would do the trick.

nitroxn
+2  A: 
Response.Write(Ajax.ActionLink(item,...));
SLaks
A: 

It was response Response.Write("...") in asp, and it looks to the be he same in asp.net.

Andrew Backer
A: 

I often use the equivalent of the following:

<%
 foreach (var intem in IE) {
    HttpContext.Current.Response.Write(Ajax.ActionLink(item,...));
} 
%>

or you could just use "Response.Write" like SLaks answer to make it easier to follow.

Pat
A: 

<%=var%> was and is simply shorthand for Response.Write(var). Under the hood they're equivalent.

egrunin