473,769 Members | 5,862 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loading ASP page programatically

I am wanting to control when a page is loaded using a separate class to manage when and how it should be loade

My current implementation needs to set a property of the page programatically (through a defined interface on the page)

I can create an instance of the code behind class (and interface) that the page inherits and implements, however, I have no way of then calling it to load

Of course, this was quite possible in VB6, by implementing an interface on the form, loading the form, setting the interface and property, and then showing the form. How can I achieve this
I
Nov 18 '05 #1
3 1625
Hi,

From your description, you want to manually control the asp.net web page's
loading via a certain class so that to do some operations before loading
the page or in other word, use the class to do some certain operation on
the page object and then let it load, yes?

As for this question, here are my suggestions:
In VB OR .NET Winform application, we can create a form class's instance
and do some intial operations on it and manually show it that'll cause the
Form_load event be fired. This is because it's in the desktop application
which all the instance a all in the certain machine 's memory.

In asp.net (Or other web application), the application is b/s mode
browser/server, the page is finally display as normal html page in
clientside's browser. The serverside page instance only exist when the web
request is being processing at the serverside. The webrequest will pass
serveral progresses in the serverside which is called asp.net "pipeline" ,
here is a tech article on this:

#The ASP.NET HTTP Runtime
http://msdn.microsoft.com/library/en...PNETHTTPRuntim
e.asp?frame=tru e

And the page instance (infact, it should be called as "PageHandle r" is be
instanced at the final progress). At that time, the page's serverside life
cycle begins, it has serval events when during the whole procedure, such as
Init,
Load, PreRender, Render..
All these are called by asp.net runtime, not controlable by us. The
following tech refrence in MSDN maybe helpful for understanding this model:

#The ASP.NET Page Object Model
http://msdn.microsoft.com/library/en...eobjectmodel.a
sp?frame=true

#Web Forms Page Processing
http://msdn.microsoft.com/library/en...msPageProcessi
ngStages.asp?fr ame=true

So I think what we can do is make use of these existing event , for example
the Page_Init or Page_Load event and put our initial processing in these
events. Also, if you want a group of pages which all have some common
precessing before load, you can define a common base page class and hook
the Init event and the other pages will derived from this base page class
so that they'll inherit the processing in the Init event or can Override
it. How do you think of this?

If you have any other ideas or question, please feel free to post
here.Thanks.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #2
Stephe

I can make this work by deriving my pages from a BaseClass which in turn Inherits System.Web.UI.P age. I wanted to force the class inheriting from BaseClass to implement a couple of methods - PageUnLoadHandl er() and PageLoadHandler (). I would call these from the BaseClass Page_Load event handler. This would give the code behind class the functionality it needs for customised handling of these Page event

I found when I add the MustInherit keyword to the base class I get a Type Abstract error when trying to view the page in the designer

Now when I remove the keyword, and alter the keywords to the methods, the problem does not go away

Is there a better way to do this

So I think what we can do is make use of these existing event , for example
the Page_Init or Page_Load event and put our initial processing in these
events. Also, if you want a group of pages which all have some common
precessing before load, you can define a common base page class and hook
the Init event and the other pages will derived from this base page class
so that they'll inherit the processing in the Init event or can Override
it. How do you think of this?


Regards

Steven Chen
Microsoft Online Suppor

Get Secure! www.microsoft.com/securit
(This posting is provided "AS IS", with no warranties, and confers no
rights.

Get Preview at ASP.NET whidbe
http://msdn.microsoft.com/asp.net/whidbey/default.asp


Nov 18 '05 #3
Cancel that..

Opening/Closing the IDE several times and compiling several times fixed it
Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1747
by: SPG | last post by:
Hi, We have an applet which is not loading on some systems. We suspect it is a security issue, but cannot be sure as of yet. Is there any way of programatically trapping the failure so we can log it somewhere? Cheers,
4
3747
by: Adrian MacNair | last post by:
Hi, I created an image gallery which displays 63 images in a slideshow. The problem is that the show was slow because each image loaded one at a time during the show. No problem right? I just did a preload script. But then the user has to sit for 5 minutes waiting for 63 images to download! My images are about 640x480 and average 100kb. Is this too much for one page to load? Should I load my slideshow into differerent windows? If so,...
2
3893
by: Dave Bootsma | last post by:
Is it possible to programatically save a certain image from a certain web page? I want to automatically get a specific graphic from a specific web page programatically so I can automate the task. I know I can NAVIGATE to the page with the MS web browser control, but at that point I am stumped as to wether I can even save the page... TIA
6
3124
by: Curious George | last post by:
I have a page that takes about 10 seconds to load the first time it is run. I would like to first display a little animated gif telling the user that the page is loading. How do I do this with .NET? I used to create a loading layer at the top of the page. Flush the layer to the buffer.
3
920
by: josepm | last post by:
Hello, My doubt is arround webforms and its load programatically. I have a class derived from System.Web.UI.Page (clsWebForm), with their own properties and methods. Inside another webform I instanciate clsWebForm, filling their properties, but how can I load the webform inside the web explorer? public class clsWebForm : System.Web.UI.Page { .... }
1
2203
by: Dino Buljubasic | last post by:
Hi, I am using C# VS2005 and I am having a problem that I did not notice before in VS2003. I have created myUserControl that contains a Panel. The panel is loaded dynamically with a number of ListViews. The number depends on the size of the form (therefore the size of the panel which is anchored to resize when form is resized.
2
2995
by: Jean Pierre Daviau | last post by:
When I have something like this in a js file. listeImg = new Array(); listeImg = new Image(w,h); listeImg.src = "centre1.jpg"; etc Are the images loaded after the page is loaded? In the same time? Before the page is loaded? The browser decision? If the visitors goes, before the procedure is over, to another page having a link to the same js file, will the other page allows for the rest of the
0
1842
by: jason | last post by:
I googled a lot, couldn't find a good solution. Any help is greatly appreciated. What I want to do is: Given a web page in a running IE browser , i want to save an image in this web page to my local folder programatically in C#/VB.net. But i couldn't save the image from its src attribute of IMG tag, because that src is generated using ajax, the image is gone from server after it is sent back to client. So the only way to save the...
1
3173
by: David Lozzi | last post by:
Howdy, I have a gridview and a sqldatasource. i need to do a little processing before I can let the GridView run and load from the SqlDataSource. I have the query I need already in the SelectCommand of the SDS so it runs when the page is first loaded. Is there a way to stop it from loading and let it load programatically? My first guess is to remove the select command from the SDS and populate it when I want it to load, then DataBind the...
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9416
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5433
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3948
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.