Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to call code in aspx webform from functions defined in code behind modules

Reply
Thread Tools

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

 
 
CW
Guest
Posts: n/a
 
      05-02-2004
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)?


 
Reply With Quote
 
 
 
 
Rick Spiewak
Guest
Posts: n/a
 
      05-02-2004
<%=FunctionName%> in the HTML will call your code-behind function, which
must be defined as Protected.

"CW" <a> wrote in message news:(E-Mail Removed)...
> 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)?
>
>



 
Reply With Quote
 
 
 
 
CW
Guest
Posts: n/a
 
      05-02-2004
Thanks for the help

"Rick Spiewak" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> <%=FunctionName%> in the HTML will call your code-behind function, which
> must be defined as Protected.
>
> "CW" <a> wrote in message news:(E-Mail Removed)...
> > 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)?
> >
> >

>
>



 
Reply With Quote
 
John Sivilla
Guest
Posts: n/a
 
      05-02-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
defined? for recursive function call v/s defined? for function call stack Alok Ruby 3 04-13-2006 11:53 AM
#if (defined(__STDC__) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) Oodini C Programming 1 09-27-2005 07:58 PM
How two modules call functions defined in each other? Tian Python 2 03-20-2005 10:31 AM
How to bring aspx code (in HTML view) to the aspx.vb code-behind? Paolo Pignatelli ASP .Net 6 02-21-2005 01:55 AM



Advertisments