I have a VB.NET WebForms app and am trying to use inline server tags in the markup to call a function that's located in a module. No matter what I do, I cannot get intellisense to show the method when I use <%= %>
or <%# %>
tags. Here's my module:
Module TestModule
Function test() As String
Return String.Empty
End Function
End Module
However, when I convert the module into a class and convert the methods into shared methods, I can do this:
Public Class TestClass
Shared Function test() As String
Return String.Empty
End Function
End Class
I can place this within my form:
<%= MyApp.TestClass.test%>
I can use this in control binding:
<asp:Button ID="cmWhatever" Text='<%#MyApp.TestClass.test%>' runat="server" />
How can I reference module methods from the markup?
'Use this instead:
Public Module TestModule
Public Function test() As String
Return String.Empty
End Function
End Module
'More over you have to use <%@ Import Namespace="Your root namespace" %> on the start of the aspx page
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments