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....
New Comments to this post are disabled