ASP.NET pages compile & run

A

andreister

Hi skilled,

I wonder if anybody knows how the ASP.NET actually does this.
So far I have been assuming the following:
1. aspx pages are compiled in gory-named files (ken0-m7f.0.jsl or
something) under my "Temporary ASP.NET Files" folder.

2. these files contain classes that extend my code-behind ones and
implement System.Web.SessionState.IRequiresSessionState interface in
order to deal with session variables.

3. if I have a read/write property in a custom user control (ahem, I
have a custom control extending System.Web.UI.UserControl),
and if somewhere in my aspx page I have the initialization code

<custom:tag runat="server" foo="zzzz">

so consequently somewhere in this awkward ken0-m7f.0.jsl I would
come across something like

#line 44 "D:\\path\\to\\project\\hithere.aspx"
__ctrl.set_foo("zzzz");

4. It's all OK so far, but when I want the variable to be an object
(for sure changes the type in code) and state

<custom:tag runat="server" foo='<%# new String("ffff") %>'>

5. the set-foo-lines in ken0-m7f.0.jsl are changed to

#line 44 "D:\\path\\to\\project\\hithere.aspx"
__ctrl.add_DataBinding( new
System.EventHandler(this.__DataBind__control8) );


Hummm... I could swear to the appropriate event handler is added to the
control handler list but WHAT should I do to invoke/catch this
delegate?
Maybe a point where to dig through?

Thank you,
Andrew
 
A

andreister

Well... overcome this!
In my custom control I've overloaded two methods:


public Control get_BindingContainer() {
Control container = get_Parent();
try{
//put in try-catch because at first time container is NULL
//though FWIW feel like doing something illegal
container = super.get_BindingContainer();
}
catch(Exception ex) {
String s = ex.getMessage();
s += "\nI am not scared, huh";
}
return container;
}

public void add_DataBinding(System.EventHandler value) {
super.add_DataBinding(value);

// uh oh, this is the magic line:
super.DataBind();
}

and now I can pass object variables from aspx pages

<custom:tag runat="server" foo="<%# new Integer(123) %>">


That's okay, but could anybody explain what actually is happening
behind the scene??
Is there a better the way than I've proposed?

Tia and kind regards,
Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top