471,605 Members | 1,564 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,605 software developers and data experts.

Global Procedures

Hello,

How can I call a public procedure from another webform class or another
generic class within an aspx cs file ?

Thanks


Jan 27 '06 #1
2 1437
You have to obtain the instance of the form/class. You can save it in the
Session property.

Then in the form you will have the code

MyClass cl = Session["MyClassInstance"] as MyClass;
if ( cl != null )
cl.PublicProcedure();

Another way is to use singletone pattern, however this is more applicable
for generic classes

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com
<Co***@Coder.Code> wrote in message
news:OG**************@TK2MSFTNGP12.phx.gbl...
Hello,

How can I call a public procedure from another webform class or another
generic class within an aspx cs file ?

Thanks

Jan 27 '06 #2
If its a generic class (the best approach, since it has little to do with
"web"), you can either create an instance of the class from within your
ASP.NET page's code and call the method, or you could make the method in the
generic class static, in which case you would call
Namespace.ClassName.MethodName() to execute your method. You need to put
these Generic classes in a separately compiled class library project and have
a reference to this project in yoru ASP.NET web app.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Co***@Coder.Code" wrote:
Hello,

How can I call a public procedure from another webform class or another
generic class within an aspx cs file ?

Thanks


Jan 27 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Dan | last post: by
8 posts views Thread by David Hitillambeau | last post: by
2 posts views Thread by chettiar | last post: by
reply views Thread by dataguy | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.