i have a method in my back end that i would like to call from my front end, but can't seem to get it working. here is my code:
<% foreach(string item in Plants){ %>
<li>
<span class="folder">
<asp:label ID="lblPlantName" runat="server" Text='<% GetPlantName(item) %>'></asp:label>
</span>
</li>
<%} %>
the getplantName method should return a string and fill the text in. But this is not getting called for some reason.
Anyone have any ideas or suggestions?
Please use <%= GetPlantName(item) %>
instead of <% GetPlantName(item) %>
and method should be Public or Protected.
To return a string you need Response.Write
which is written in shorthand as <%=%>
so:
<%= GetPlantName(item) %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With