Welcome to Tech-Review.Org Sign in | Join | Help

.net_2.0

My coding blog entries. Typically will either be more complex coding examples or overcoming product issues / troubleshooting resolutions.
Ponderance: The Modal Extender...
I am definately not in the league that rocket scientists that program this stuff are.  Alas, though - I am one that will spend 2 years religiously researching and trying new things until I can solve a problem. With the ModalPopup issue where databound controls simply dissapear - just well - drives me nuts...

So, I have been digging into the code trying to dissect the method of the madness.  And for the life of me - I am not getting why they are using the methodology of capturing the whole entire layout of a page.

1. Their process is ignorant of whether the page is CSS1 or CSS2 - which makes html validation a hassle.  There are issues with formatting that makes the ability identify keywords versus strings, and the parser in use is a bit ambivelant as it assumes that properties are being correctly parsed.  For instance.  Current implementation cares less if there is a tag explicity stating if a control is visible. I experimented with DDL's and the Gridview and explicitly set the  styles = "visibility = "visible" on the controls.

Take this example:

                Show Only:
                <select name="ctl00$ctl00$ctl00$dropShowOnly" onchange="BLOCKED SCRIPTsetTimeout('__doPostBack(\'ctl00$ctl00$ctl00$dropShowOnly\',\'\')', 0)" id="ctl00_ctl00_ctl00_dropShowOnly">
 
    <option value="28">test</option>

</select>

Notice that for this control it doesn't have any visibility settings and there is no global div that wraps them.  This is true of the buttons and so forth.  So you would assume - the parser would handle properly if the element has the property set. You should in theory be able to fool it but explicitly adding the tag - and yet it doesn't which brings me to:

2. Current process for the modal popup doesn't recurse the DOM structure in a tree level.  If you are going to grab a layout by doing it manually then you have to be able to mimic the DOM and traverse it.  This is why databound objects are such an issue.   I am just theorizing naturally on this but from digging into the code there is no recursive model.

3. Why is such a complex method being used?  Why recurse the entire page to grab elements - when the UpdatePanel andn the ModalPopup are not actually interwined.   The actions of both are independent ...and besides the afore listed issues...


In a true DHTML world - and let's face it we do have a cut off on what technology  we support.  For instance on my sites - I support only broswers that are truly compliant to the 1.1 specs.  Why? My content - and a browser should not be less than a year out of date anyways. If a customer can't keep updates to their browsers considering all the issues with security, viruses and the likes - odds are they will not be a 'consistent web customer' for customer loyalty - provide a phone number as they will probablly request services or products that way anyways....  So, you target.


So, I think a better solution is to use the z-index ability to set which layer is visible and do something similiar to this: BUt I think also it will only work in a simple scenario...

function tabtwoontop() {
 tab1.style.zIndex="2";
 content1.style.visibility="hidden";
 tab2.style.zIndex="3";
 content2.style.visibility="visible";
 tab3.style.zIndex="1";
 content3.style.visibility="hidden";
 tab4.style.zIndex="0";
 content4.style.visibility="hidden";
 startmessage.style.visibility="hidden";
}
function tabthreeontop() {
 tab1.style.zIndex="2";
 content1.style.visibility="hidden";
 tab2.style.zIndex="1";
 content2.style.visibility="hidden";
 tab3.style.zIndex="3";
 content3.style.visibility="visible";
 tab4.style.zIndex="0";
 content4.style.visibility="hidden";
 startmessage.style.visibility="hidden";
}
function tabfourontop() {
 tab1.style.zIndex="2";
 content1.style.visibility="hidden";
 tab2.style.zIndex="1";
 content2.style.visibility="hidden";
 tab3.style.zIndex="0";
 content3.style.visibility="hidden";
 tab4.style.zIndex="3";
 content4.style.visibility="visible";
 startmessage.style.visibility="hidden";
}

It would require devs to set a master div of a index of zero.  However each Modal would have a unique ModalLayerIndexID as value int.  Then all we would need is a the following program logic:

If ModalShow - grab current ModalLayerIndexID.

Do the for if loop and set all visibility="hidden" of the ModalLayerIndexID that do not match...when it does trigger it to visible...

Yep, so you are asking but how do you know how many...you just do a search for the modal types and build the array from what is on the page...if duplicate indexes assume both get displayed or just grab the first one and log an exception that there were duplicates...


Seems to me this would resolve alot of issues with Modals... as there would not need to be logic to figure out what every element is...  Whatever the parent div setting is takes precedence...  yes a step or two for the dev - however - speed and agility...

[Extended]

I think the reason why the layout is saved the way it does is because of the designed flexibility.  The Modal has no idea if its part of update panel for instance.  And since one can have multiple controls all emebedded but in a logical reference to the modal - you have to basically scrape the page...


So the scenario and thought process above may be only applicable to controlling only a simple scenario unless there were associated with all of the controls which would be a bugger to implement I think.... For instance having a modalpopup associated with each row of data in the Gridview - it would be impossible to manage and track

I thnk I had too much wine and not enough cheese....










Posted: Friday, October 27, 2006 10:27 PM by Jody

Comments

ASP.NET AJAX Toolkit Forum Posts said:

There are just a ton of issues with the current process and I am a bit confused why the process is what
# October 27, 2006 11:51 PM

davior said:

Jody,

There is a simple explaination why ATLS hides the dropdown lists when displaying a modal dialouge. Dropdownlist (the SELECT html element) is based on an old windows component that regardless of settings and zindex will alway show through any HTML element that you attempt to put on top of it. For this reason they have assumed that the best way to deal with this (when poping up a modal window is to hide these controls to prevent them from showing through. This shouldn't be an issue because you have modal dialogue open which is the only thing the user should have access to. I am assuming that they dont hide a dropdownlist if it is on the panel that is your modal window (do they?). If they do then it should be modified to loop through all SELECT controls not inside your modal dialogue panel..

Cheers

David
# November 3, 2006 1:30 AM

davior said:

I forgot to mention that this is an IE related problem.
# November 3, 2006 1:36 AM

Jody said:

Thanks for the comment David...  

No if a panel is on the forefront all is good.  And your explanation - well explains it - as it is typically ponly an IE issue (and unfortunately  a bugger with current issues of the DDLs never appearing back after a modal pops up over it...)...The weird part is when the modal is closed the DDLs are still on the page just never made visible again by the DOM...  I think my vent in the original blog entry was just the mere fact this has been an issue since Atlas - and as much stink as I make about it - its not fixed yet...


Thanks for taking the time to post - much appreciated.  And congrats you're my first blog  comment (beside me myself and I)...

Again thanks...

# November 4, 2006 2:39 PM
New Comments to this post are disabled