使用 Internet Explorer 9 时,ASP.NET doPostBack 函数未呈现在页面上

发布于 2024-10-25 04:13:05 字数 320 浏览 1 评论 0原文

Internet Explorer 9 中存在一些问题,导致 doPostBack 功能无法在我的页面上呈现。如果我切换到兼容模式,页面将正确重新呈现并按其应有的方式运行。

我已经尝试了添加另一个控件的解决方案,这将使 ASP.Net 认为我需要 PostBack 并因此呈现该控件,但仍然没有成功。我添加了另一个需要回发的控件(LinkBut​​ton、带有 AutoPostback 的 DDL 等),但它仍然没有在页面上呈现。

我没有使用任何输出缓存,所以我不需要关闭它。

有什么方法可以阻止 doPostBack 在所有页面上呈现,而我不知何故为 IE9 设置了该设置?

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 doPostBack from rendering on ALL pages and I somehow that that set for IE9?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

甜心小果奶 2024-11-01 04:13:05

框架中可能有代码确定此行为背后的网络浏览器的功能。

添加您自己的 __doPostback 并添加以下行:

            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);
            }

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);
            }
自由如风 2024-11-01 04:13:05

如果你想要自己的回发:

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

}

if you want your own postback:

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

}

风筝在阴天搁浅。 2024-11-01 04:13:05

实际上,您还需要 EVENTTARGET 和 EVENTARGUMENT 的隐藏字段。我有一个解决方法,但我不知道为什么 IE9 不能很好地与我的网站配合。什么会导致这样的情况呢?其他 AutoPostBack 功能也无法正确呈现。 onSelectedIndexChanged 在 IE9 中没有重新定义,我必须在 javascript 中检测它并以这种方式连接它。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文