Code Behind + Page Events not firing

liunx

Guest
in one of my ASP.NET applications i fill a dropdownlist with data from a database source. normally i do this in the Page_Load sub. However for this app i am using a code behind source, and i find that with doing this the Page events don't fire (specifically, Page_Load).

Is this because it's an included class and not the actual Page itself, or am i doing something wrong? How do i link the page's event controls to the class's?

the .vb file has a class declaration like this:
Public Class Lab_Request
Inherits System.Web.UI.Page
...
End Class

and in the .aspx file the page directive includes it like so:
<%@ Page ... Src=http://www.htmlforums.com/archive/index.php/"lab_request.vb" Inherits="Lab_Request"%>Make sure you correctly have the setup for the inherits property on the @Page instruction. Also make sure that you do not have another Load event specified in the Page in script tags.well the inherits is 'functioning' fine in that i have other functions working from the code. If i set the dropdownlist onLoad property to Page_Load for example, it all works great... it's just that an actual Page_Load in the code will not fire it seems.

There is no script code of any kind on the actual ASPX page. I think this may just be a property of code behind classes themselves? The thing is i have to explicitly declare controls in the class for me to be able to manipulate and link them, would i have to do something similar for Page events?Did you use the Handles keyword on your page load event. I have ran into a similar problem and that is waht it was:


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadNope, that's exactly what i was looking for. Handles establishes the link perfectly... thanks.
 
Back
Top