Archive for 22nd December 2004

ASP.Net, <object> tag, and Viewstate

I’m stumped. If anyone can help me, I’d appreciate a pointer.

In an ASP.NET page, I’m embedding a Windows Forms control by use of an <object> tag. My challenge is getting the state of the embedded object during postback, and maintaining / restoring the object after postback. Since the object tag is not server-side, I can’t figure out how to retrieve its state in my Page_Load() event.

The tactic that I was (mostly) pursuing was a client-side event-handler for the onblur() event of the <object> tag, which would grab the state of the object (by way of reading a property, i.e., document.forms[0].myObject.MyProperty) and write it to a hidden <INPUT> tag, which I figured I could retrieve on the server-side by looking at the Request object. So, basically, very non-ASP.NET-y in approach.

I don’t know if this is the right approach and it certainly seems error-prone (at least, I spent the whole day today trying to watch the process by writing Javascript alert() functions — a side question is ‘how the heck do ASP.NET programmers debug Javascript?’ ). Any feedback appreciated.

Am I doomed to handle the state / postback issue by writing separate HTTP POST/GETs within the embedded Windows Forms object?

Unleash the mimes!

Forget the death penalty – if you want to alter people’s behavior, sic a mime on them:

Another innovative idea was to use mimes to improve both traffic and citizens’ behavior. Initially 20 professional mimes shadowed pedestrians who didn’t follow crossing rules: A pedestrian running across the road would be tracked by a mime who mocked his every move. Mimes also poked fun at reckless drivers. The program was so popular that another 400 people were trained as mimes. Link via [Boing Boing]