Welcome to Manicprogrammer Sign in | Join | Help

DeusExMachina

Coding like no man has done before.
MS Brainwasher

- In the Beginning there was The CGI.

(At least for me.)

Some times i get surprise by how the sum of our experiences changes us without noticing that a change even happened.
The change sometimes is so profound that one could swear that nothing had ever changed at all. That things are, and always were the way they are.
Some weeks ago i was faced with a singular problem (the kinds that make us want to jump through the window!). I had a Webform, with a DropDown list that was loaded after an event triggered in the form by a DatePicker-like control being both of then inside an UpdatePanel. So far so good.

Than came one user (I’m one of those 'blame the user' guy, I gotta admit it), and made the simplest of the requests:

"- I'd like to have the dropdown list loaded not when i change the date in the DatePicker, I’d like to have it changed only when i click the DDL. When my date change's, I’d like it only being cleared."

- Ok. I said. Nothing too difficult.

I though:

"Sure too easy. Just hookup the load method in the OnClick event of the DDL."

So it happens that i just realized, that there is no server-side OnClick in DDL.

"Ok.." - i thought - " just gotta add a client side onclick call to the DDL, and make it call the __doPostBack(). Easy."

Not really.

So it happens that Ajax.Net doesn't like being bypassed. The callback wasn't fired and i've got to trick it a little bit.
Ok, I’m used to trick Webform's. I've being doing it since Asp.Net 1.0, so it was no news.

After messing around for an uncomfortable few hours I’ve got it working.

Then, being Agile as i never was, I’ve called my user (oh, dear user!) t show him the job 'done'. He watched when i presented the new behavior and said:

“- Ok, that's it. Just one little problem. The DDL still need to be opened when the content reloads."

Ok then. It's not a trivial task since DOM doesn't give tools for that job, but i'm smarter than DOM.

First of all i recurred to own set of tools, being ExtJs and jQuery some of them. I already knew that Ext would do the Magic of expanding a DropDown for me, so I thought (you already know how I like thinking, don't you? =} ):

- "Yeah, right. Just gotta hook the reload event of the UpdatePanel to the ext.combobox.expand() method, and it'll be allright."

How fool am i? How fool for believing such an event exists. How fool for trusting M.S. (Mort Softwares) that everything woul do nicely working with GREAT Ajax.Net.

After that i had a really hard time. Trying to bind things with such heterogeneous frameworks as Ajax.Net and, huh, 'EVERYTHING ELSE' is not for the faint of the heart.
In the end i had given up trying to make then speak to each other and rebuilt the load method required by the DDL as an xml-spiting-handler and bound it to the ExtJs ComboBox, applied to a Webforms DDL, with it's native Ajax Calls and, after that, I’ll I needed to do was:

Combo.on('load',function(){
        this.expand();
});
Ok, i had it! Just the behavior that my friendly user asked!!  

Cool, everything was fine, ok?
- NOT!!!!!!!

No, it wasn't. And here let me starting explaining why I’m entitling this post as MS Brainwasher.
After struggling with tiers that i knew pretty well (being Ajax.Net the least known), and doing something that I’ve being doing for the last eight or nine years, that I’ve done with even Perl, I had a fight that I’m not so sure I had to endure, and definitely I didn't like it.

So to describe my feeling for all of it,’ I’ll tell how it ended.

When testing, everything was working smoothly, everything but getting the value of DDL.SelectValue. Nothing i did worked. Nothing.

Because it was almost midnight, because i was tired and hungry and because if looked one more time at that code i was throwing myself from my window, I decided to ask my dear friend Heynemann for a help, by wich he replied:

"Why don’t you get it's value by querystring?"

I felt stupid. More stupid then i felt in some time.

When bypassing the Webforms own methods to reload the DDL, he was not reflecting the change in a way that the webform was understanding, that i already knew, but not considering obtaining the value trough a simple Request.QueryString was too much for me.

That's it fellas. MS not being content writing tool for Morts want's us all turning into Morts as well.

Something, which they’ll never do with me! For sure!

Posted: Thursday, August 30, 2007 12:22 AM by claudio.figueiredo

Comments

No Comments

Leave a Comment

(required) 

(required) 

(optional)

(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS