Hi, Iam new to ASP programming, iam devloping a sample application using Web devloper express 2008, In my application ,iam having 2 asp pages(in VB ) default.aspx and page2.aspx iam trying to call a function which is in page2.asp from default.asp,how to do this? i know that i need to create an instance of class and call the function ,but how to do this in ASP? Please help, Thanks in advance,
This looks to be using ASP.NET.. do the pages have the code-behind file? e.g default.aspx.vb and page2.aspx.vb
Yes, this is ASP.NET. First, why do you want to call a function on another page? I am afraid to ask, but if this is common code it should be in a shared class not embedded in the code-behind of the other page. Also, the code-behind should be limited to event-handlers, validation, and other UI-specific functionality. It should consume business services as needed too. Please revisit your design.
Kindly make a class, go to App_code folder,right click add items, add a class file, give it some name... in the class file , add a namespace eg: imports system.**** imports system.**** namespace myclass public class xyz public shared function myfunction() <-- your code --> end function end class end namespace ------------------------------- now call this class function in your both the code behind files like this imports myclass <-your namespace name here partial class default sub page load dim x as new xyz <- your class name in the namespace 'then x.myfunction() end sub end class ------------------- this is the way how you show do that if any problems, mail me at , and i will send you a nice ebook for ASP.NET