开发者

ASP.NET doPostBack function is not rendered on the page when using Internet Explorer 9

开发者 https://www.devze.com 2023-02-19 02:36 出处:网络
There is something about Internet Explorer 9 that prevents the doPostBack functionality to NOT render on my pages.If I switch into Compatibility mode, the page re-renders correctly and functions as it

There is something about Internet Explorer 9 that prevents the doPostBack functionality to NOT render on my pages. If I switch into Compatibility mode, the page re-renders correctly and functions as it should.

I have tried the solution for adding another control that will make ASP.Net think that I need a PostBack and therefore render the control but that still didn't do it. I've added another control that requires a postback (LinkButton, DDL with AutoPostback, etc) it is still not rendered on the page.

I am not using any output caching so I don't have that to turn off.

Is there some way to prevent the d开发者_Python百科oPostBack from rendering on ALL pages and I somehow that that set for IE9?


Possibly there is code in the framework that determines the capabilities of the web-browser that's behind this behaviour.

Add your own __doPostback and add these lines maybe:

            if (theForm.__EVENTTARGET == null || theForm.__EVENTARGUMENT == null) {
                var lmTarget = document.createElement("INPUT");
                lmTarget.name = "__EVENTTARGET";
                lmTarget.id = "__EVENTTARGET";
                lmTarget.type = "hidden";


                var lmArgument = document.createElement("INPUT");
                lmArgument.name = "__EVENTARGUMENT";
                lmArgument.id = "__EVENTARGUMENT";
                lmArgument.type = "hidden";

                theForm.appendChild(lmTarget);
                theForm.appendChild(lmArgument);
            }


if you want your own postback:

function postBackForm(targetElementId) {
var theform = document.forms[0];
theform.__EVENTTARGET.value = targetElementId;
theform.__EVENTARGUMENT.value = "";
theform.submit();

}


Actually, you need hidden fields for EVENTTARGET and EVENTARGUMENT as well. I've got a workaround, but I don't know why IE9 isn't playing nicely with my site. What would cause that? Other AutoPostBack functionality doesn't render correctly too. onSelectedIndexChanged isn't renedered in IE9 and I have to detect it in javascript and hook it up that way.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号