By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,254 Members | 2,365 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,254 IT Pros & Developers. It's quick & easy.

How to call code in aspx webform from functions defined in code behind modules

P: n/a
CW
I find it necessary to mix code-behind and non-code behind techniques
sometimes.

I have utility functions defined in a VB module. Is there anyway for me to
call functions defined in VB module from aspx form (i.e., code mixed in with
html elements) or even call public shared functions from other code behind
classes)?
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
<%=FunctionName%> in the HTML will call your code-behind function, which
must be defined as Protected.

"CW" <a> wrote in message news:OU**************@TK2MSFTNGP12.phx.gbl...
I find it necessary to mix code-behind and non-code behind techniques
sometimes.

I have utility functions defined in a VB module. Is there anyway for me to
call functions defined in VB module from aspx form (i.e., code mixed in with html elements) or even call public shared functions from other code behind
classes)?

Nov 18 '05 #2

P: n/a
CW
Thanks for the help

"Rick Spiewak" <ri*********@mindspring.com> wrote in message
news:O2*************@TK2MSFTNGP09.phx.gbl...
<%=FunctionName%> in the HTML will call your code-behind function, which
must be defined as Protected.

"CW" <a> wrote in message news:OU**************@TK2MSFTNGP12.phx.gbl...
I find it necessary to mix code-behind and non-code behind techniques
sometimes.

I have utility functions defined in a VB module. Is there anyway for me to call functions defined in VB module from aspx form (i.e., code mixed in

with
html elements) or even call public shared functions from other code behind classes)?


Nov 18 '05 #3

P: n/a
You can access code from code modules, however you must declare the
Module Public and you must qualify the call with the proper namespace.
For example:

in you module:

Public Module Module1
Public Function getString() As String
Return "from module"
End Function
End Module

in your call:

<%=VBTest.Module1.getString()%>

where VBTest is the name of the project or parent namespace of
Module1.

hope this helps,

John
Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.