[Mono-list] CodeBehind Problems

Marek Habersack grendel at caudium.net
Fri Nov 18 14:28:01 EST 2005


On Fri, Nov 18, 2005 at 09:14:05AM -0700, Ken Swift scribbled:
> I apologize...what I was trying to say is that none of my compiled code is
> firing (ie, page_load events). In my HelloWorld example I simply set the
> "Text" property of an asp:literal control in the page_load event and that
> worked fine, but in my more complex example none of my page load events
> fired.
>  Thanks and sorry for missleading -- Ken
Try putting this at the top of your aspx file:

<%@ Page Language="C#" CodeBehind="yourfile.aspx.cs" AutoWireupEvents="true" Inherits="YourNamespace.YourClass"%>
                   ^^or VB, depends on what you're using

The important bit is the AutoWireupEvents attribute, which tells the ASP.NET
engine to call the event handlers. Of course, you also must have a bin/
subdirectory in your app's root dir with the DLL file containing your
compiled codebehind code. Alternatively, you can put your .cs files
alongside the .aspx ones in the app's root dir and add the
src="yourfile.aspx.cs" directive to the above set. That will make the
ASP.NET engine to dynamically compile the .cs file when the corresponding
.aspx is requested - that's nice for testing your app.

hope that helps a bit, regards

marek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.ximian.com/pipermail/mono-list/attachments/20051118/5b544293/attachment.bin


More information about the Mono-list mailing list