page-lifecycle

Alternatives to System.web.ui.page

I have an ASP.Net application and I've noticed through using profilers that there is a sizable amount of processing that happens before my page even runs. In my application, we don't used viewstate, asp.Net session, and we probably don't require most of the overhead that comes of a consequence of using the asp.net page lifecycle. Is the...

How can page events be handled from a usercontrol? (VB.net)

I would like some code to execute at the "preload" stage of my usercontrol's lifecycle. However the preload event is only available on the Page object. So, I added the following method to my usercontrol: Private Sub Page_PreLoad(ByVal sender As Object, ByVal e As System.EventArgs) Handles Page.PreLoad However, I know get the compile...

What is the 'page lifecycle' of an ASP.NET WebForm?

I'm looking to get a more thorough understanding of the ASP.NET page lifecycle. I'm in the process of building custom form controls and have found my knowledge in this area to be lacking. Are there any resources, tutorials, etc. that you've used to better understand this area? Are there any tools you've used to improve your knowledge i...

What is the best alternative for QueryString

We heard a lot about the vulnerabilities of using QueryStrings and the possible attacks. Aside from that, yesterday, an error irritated me so much that i just decide to stop using QueryStrings, i was passing something like: Dim url As String = "pageName.aspx?type=3&st=34&am=87&m=9" I tried to Response.Write(url) in the redirecting...

Asp.net BasePage Properties using ViewState are cleared on Postback

Here are the basics of my setup: I have a BasePage class that inherits from System.Web.UI.Page. BasePage has two properties implemented such that their get/set does so from two different items in the ViewState collection (ex this.ViewState["Year"] from the BasePage). I have another class that then inherits from BasePage, lets call it ...

doing an action when the page exits

Hi, I have an ASP.NET(2.0 C#) Web application, and I wanted to know how to do an action once the user moves to another page or leaves the application. Is there a method like page_load is for when the user enters the page, except this one is for exiting the page? Thanks ...

Asp.net "Global" variables

I'm writing a page in ASP.NET and am having problems following the cycle of initialization on postbacks: I have (something akin to) the following: public partial class MyClass : System.Web.UI.Page { String myString = "default"; protected void Page_Init(object o, EventArgs e) { myString = Request["passedString"]; ...

WCF client in ASP.net Page

Can anyone advise of a good pattern for using a WCF Service from an ASP.net Page? It seems that if the lifetime of the Client(:ServiceModel.ClientBase) is not properly controlled that we get PipeException thrown. It currently exists as a field of the Page class, but is being reinstantiated upon each page request without being cleaned up ...

Event not firing early enough in .NET Page cycle

I have a Page (form) that has many UserControls on it, and I'm trying to have a single button to save everything. The UserControls are actually nested, so I wanted to somehow signal to each UC that it should save itself, instead of somehow wrapping everything into one event or having a single event trigger a cascade of save events. My ...

ASP.NET 2.0 PageComplete Event troubles and File downloading

I am trying to place an action to happen after an entire .aspx page displays. The "action" is a function that uses the Response object to send a file to the user. More detailed information: I am trying to replicate the behavior of a link on the page, from a sidebar. I.E. I have a link on the main page for the Export action, and it wor...

Multiple controls with the same ID 'add0' were found. FindControl requires that controls have unique IDs

Previously Called: How to deal with dynamically created controls under load in aspx in response to a question below: the information required to determine which controls to restore is contained in a dedicated viewstate object. I am dynamically creating controls in the codebehind page - these controls are all hooked up to click handler...

How do I override page load lifecycle in ASP.NET to prevent ASPX form from loading?

I need to test a condition in several ASPX code-behind files and, in some cases, would like to completely bypass the normal page load process so that the corresponding ASPX page is not loaded. Intead, I'd like to send a custom response to the browser that's written from a code-behind method. Does anyone know where to start- what method...

What is the difference between Page.IsPostBack and Page.IsCallBack?

I've recently ran into some code that checks Page.IsCallBack but I wasn't sure how it is different from Page.IsPostBack. Can anyone enlighten me? Edit: Are they mutually exclusive or can both occur at the same time in a given situation? ...

Trigger-Method of WebControl is not fired

this is my scenario: i have a page with a placeholder. the page adds dynimcally different kinds of controls (we wan't to display some data - getting the id via querystring or postback, as we also have a tree) to this placeholder. the added controls all, more or less, contain a textbox (name of the displaying element), checkbox (active-st...

How to update page data after event handling?

On Page_Init I create a table of dynamically created controls based on a couple of database tables. One of the controls is an ImageButton for moving an list item up the list. What this event handler does is to update the SortOrder column in the database for the affected items. Now the problem is that since the controls are created in th...

ASP.Net - Strange behavior of nullable types in Application_EndRequest

I am using Global.asax to perform logging at the end of each request via the Application_EndRequest event. However, I am seeing some odd behavior of certain values stored in the HTTPContext.Current.Items collection. Below is the debug output for a nullable Enum. You can see that there is a value, but HasValue resolved to False?! {Syst...

Which control posted back my page? (ASP.NET Page)

1 -I wonder that how to get which control posted back the page and is there any way to convert Request["__EVENTVALIDATION"] value string to understandable string. 2- in which order components will be bind and how do they get their value from viewstate? Thank 4 all your helps... ...

Which event fires after using the Cancel command on a DetailsView?

I need to perform a few checks (enable or disable a label elsewhere on the page) after the user Inserts or Cancels the DetailsView. I have to do this because the DropDownList.SelectedIndexChanged doesn't fire during this event (which is dumb in my opinion, since the index DOES change). ...

ASP.NET request lifecycle confusion

I am new to C# and .Net and am coming from a Java background. I am trying to get my head around the .NET way of doing web applications and am not having much luck. I want to build an application to handle requests urls and write responses that return images. Having only used Java servlets in the web application field I am after some goo...

Why do some events in child controls fire in reverse order in the ASP.Net page cycle?

From the ASP.Net Page Lifecycle article on MSDN: Although both Init and Load recursively occur on each control, they happen in reverse order. The Init event (and also the Unload event) for each child control occur before the corresponding event is raised for its container (bottom-up). However the Load event for a container occurs bef...