More fun and games with

23 Mar 2006


Starting to find my way around Asp.Net

I’m setting up a form for “forgotten password”. This is standard enough – give us your email address and we email you your password for the site.

This form has a single-line text input field (enter your email address here) and one button (Send Password). I want the button’s onsubmit event to be fired when if the user types in their email address and then (reasonably enough) presses the Enter key instead of groping for the mouse and clicking the big Send button. Works fine in Firefox, but not in IE. The form posts back, but I don’t get the OnSubmit event

Fix (and an excellent explanation) from the invaluable 4 Guys Obviously enough, I need to add another textbox – and since I don’t want another textbox I’ll make it invisible.

<asp:TextBox runat="server" style="visibility:hidden;display:none;" />

page_load doesn’t fire

22 Mar 2006


The Page_Load event in one of my pages was not firing – I eventually tracked this down to the InitializeComponent function (inside the “Web Form Designer generated code” block) The following line, which should have been automatically generated, was missing :

this.Load += new System.EventHandler(this.Page_Load);

The trouble is that I tend to stay away from the design view and work almost exclusively in the HTML view. And in making a new page, based on an existing one, this vital line was omitted. Much frustration.