Example app: I have an xml file that contains the data for a books
index (ie, words grouped alphabetically). I am using a TreeView to
navigate the list.
The list has 26 letter nodes, and about 300 word nodes total. I have
the TreeView bound to an XmlDataSource. The PopulateOnDemand="True" for
the letters is set because otherwise, .net embeds the whole 326 nodes
into the html. This results in a file that is about 150K which is way
to big, particularly if it is posting back.
There is also a DropDownList on the form for navigating into chapters directly.
The PopulateOnDemand="True" generates a bunch of Callback script. The function that causes the problem is:
function WebForm_InitCallback() {
var count = theForm.elements.length;
var element;
for (var i = 0; i < count; i++) {
element = theForm.elements;
var tagName = element.tagName.toLowerCase();
if (tagName == "input") {
var type = element.type;
if
(type == "text" || type == "hidden" || type == "password" ||
((type == "checkbox" || type == "radio") && element.checked)) {
__theFormPostData += element.name + "=" +
WebForm_EncodeCallback(element.value) + "&";
}
}
else if (tagName == "select") {
var selectCount = element.children.length;
for (var j = 0; j < selectCount; j++) {
var selectChild = element.children[j];
if ((selectChild.tagName.toLowerCase() == "option") &&
(selectChild.selected == true)) {
__theFormPostData += element.name + "=" +
WebForm_EncodeCallback(selectChild.value) + "&";
}
}
}
else if (tagName == "textarea") {
__theFormPostData += element.name + "=" +
WebForm_EncodeCallback(element.value) + "&";
}
}
}
The
element.children object doesn't exist in the W3C DOM, it is
IE specific. Mozilla fails to run this function which fails to
initialize the Callback functionality on the page. This means that
Mozilla isn't able to populate nodes on demand.
Note that this only becomes a problem when a TreeView and a DropDownList coexist on the same form. The offending code exists within the
else if (tagName == "select") {...} block.
I posted this a .Net framework compatibility bug, but I'm looking for a
workaround. I don't know anything about the WebResource.axd
functionality. Is this something that I can customize, or am I stuck
with Microsoft's offering?
Luke