user2726536
user2726536

Reputation: 33

Code behind does not run from HTML with <% tags

I have the following HTML:

<td align="center">
        <%#CreateDynamicHTML()%>

The <%# %> tags, whatever they're called, are meant to point to a code behind function. Here is my function:

Public Function CreateDynamicHTML() As String
    Dim html As String = String.Empty
    'create lots of HTML

    Return html
End Function

It compiles but the function does not run. Put a break point in there, doesn't get hit. What's going on?

Upvotes: 0

Views: 45

Answers (1)

Blaise Alicki
Blaise Alicki

Reputation: 171

The # symbol is for databinding. The = symbol is short for Response.Write. Try using <%=CreateDynamicHTML()%>.

Upvotes: 1

Related Questions