网页在加载时使用ascx控件时未在IE中显示.尽管它在chrome中工作正常 [英] page not showing in IE while using ascx control on load.. although its working fine in chrome
本文介绍了网页在加载时使用ascx控件时未在IE中显示.尽管它在chrome中工作正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MemberReviewMaster.aspx.cs" Inherits="MemberReviewMaster" %>
<%@ Register Src="~/MemberReviewPage.ascx" TagPrefix="rv" TagName="rv1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="App_Themes/new.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function showPopUp(el) {
var cvr = document.getElementById("cover")
var dlg = document.getElementById(el)
cvr.style.display = "block"
dlg.style.display = "block"
if (document.body.style.overflow = "hidden") {
cvr.style.width = "1024"
cvr.style.height = "100%"
}
}
function closePopUp(el) {
var cvr = document.getElementById("cover")
var dlg = document.getElementById(el)
cvr.style.display = "none"
dlg.style.display = "none"
document.body.style.overflowY = "scroll"
}
</script>
</head>
<body onload="showPopUp('dialog');">
<form id="form1">
<div id="cover" ></div>
<div id="dialog" >
<rv:rv1 ID="id1" runat ="server" LoadNodesProvider="~/MemberReviewPage.ascx"/>
<br /><a href="#" onclick="closePopUp('dialog');">[Close]</a>
</div>
<a href="#" onclick="showPopUp('dialog');">Show</a>
</form>
</body>
</html>
推荐答案
而不是
<body onload="showPopUp('dialog');"></body>
尝试从页面的代码后面注册javascript函数.
try registering the javascript function from codebehind of page.
protected void Page_Load(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "showPopUp", "showPopUp('dialog');", true);
}
让我知道是否有帮助.
Let me know if it helps.
这篇关于网页在加载时使用ascx控件时未在IE中显示.尽管它在chrome中工作正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文