要让弹出的模式对话框获得最新的记录,就需要清空模式对话框所在网页的缓存,以便能得到最新记录,这就需要在网页的<head></head>中间添加如下代码:
<metahttp-equiv="PRAGMA"content="NO-CACHE">
为了能够正常使用模式对话框中的服务器端控件,避免弹出网页的烦恼,在网页的标头中加如下代码:
<basetarget="_self"/>
完整代码如下:
<headrunat="server">
<title>无标题页</title>
<metahttp-equiv="PRAGMA"content="NO-CACHE">
<scripttype="text/javascript"language="javaScript"src="/_layouts/images/include/timein.js"></script>
<linkhref="../CSS/style.css"rel="Stylesheet"type="text/css"/>
<basetarget="_self"/>
</head>
这样就解决了弹出对话框的问题了.还有在标签选项卡中使用服务器端控件防止选项卡重置的问题,代码如下:

<%...@PageLanguage="C#"AutoEventWireup="true"CodeFile="CarAllInfo.aspx.cs"Inherits="web_CarsManage_CarAllInfo"%>

<%...@RegisterSrc="Controls/CarAllInfoControls/CarYearCheckInfo.ascx"TagName="CarYearCheckInfo"
TagPrefix="uc3"%>
<%...@RegisterSrc="Controls/CarAllInfoControls/CarMaintainInfo.ascx"TagName="CarMaintainInfo"
TagPrefix="uc4"%>
<%...@RegisterSrc="Controls/CarAllInfoControls/CarOilInfo.ascx"TagName="CarOilInfo"
TagPrefix="uc5"%>

<%...@RegisterSrc="../CarAttemper/Controls/CarInfo.ascx"TagName="CarInfo"TagPrefix="uc1"%>
<%...@RegisterSrc="Controls/CarAllInfoControls/CarInfo.ascx"TagName="CarInfo"TagPrefix="uc2"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<scriptlanguage="JavaScript">...
//SwitchTabEffect
functionswitchTab(tabpage,tabid)...{
varoItem=document.getElementById(tabpage);
for(vari=0;i<oItem.children.length;i++)...{
varx=oItem.children(i);
x.className="";
vary=x.getElementsByTagName('a');
y[0].style.color="#333333";
}
document.getElementById(tabid).className="Selected";
vardvs=document.getElementById("cnt").getElementsByTagName("div");
for(vari=0;i<dvs.length;i++)...{
if(dvs[i].id==('d'+tabid)&&dvs[i].controlFlag=="yes")...{
dvs[i].style.display='block';
document.getElementById("ChosedIndexId").value=dvs[i].choseIndex;
}
elseif(dvs[i].controlFlag=="yes")
dvs[i].style.display='none';
}
}

functiondoInitTab()...{
try...{
varindex=document.getElementById("ChosedIndexId").value;
varshowDivName="Tab"+index;
switchTab('TabPage1',showDivName);
}catch(ex)...{}
}
</script>
<styletype="text/css">...
body{...}{font-size:12px;font-family:宋体}
ul.TabBarLevel1{...}{
list-style:none;
margin:0;
padding:0;
height:29px;
background-image:url(Images/q20066292643.gif);
}
ul.TabBarLevel1li{...}{
float:left;
padding:0;
height:29px;
margin-right:1px;
background:url(Images/320066292748.gif)lefttopno-repeat;
}
ul.TabBarLevel1lia{...}{
display:block;
line-height:29px;
padding:020px;
color:#333;
background:url(Images/w20066292815.gif)righttopno-repeat;
white-space:nowrap;
}
ul.TabBarLevel1li.Selected{...}{
background:url(Images/220066292838.gif)lefttopno-repeat;
}
ul.TabBarLevel1li.Selecteda{...}{
background:url(Images/42006629294.gif)righttopno-repeat;
}

ul.TabBarLevel1lia:link,ul.TabBarLevel1lia:visited{...}{
color:#333;
}
ul.TabBarLevel1lia:hover,ul.TabBarLevel1lia:active{...}{
color:#F30;
text-decoration:none;
}
ul.TabBarLevel1li.Selecteda:link,ul.TabBarLevel1li.Selecteda:visited{...}{
color:#000;
}
ul.TabBarLevel1li.Selecteda:hover,ul.TabBarLevel1li.Selecteda:active{...}{
color:#F30;
text-decoration:none;
}
div.HackBox{...}{
padding:2px2px;
border-left:2pxsolid#6697CD;
border-right:2pxsolid#6697CD;
border-bottom:2pxsolid#6697CD;
display:none;
}
.table{...}{
text-align:left;
width:100%;
border:2pxsolid#ABCFFF;
}

.tabletd{...}{
height:22px;
line-height:22px;
text-indent:12px;
border:1pxsolid#ABCFFF;
text-decoration:none;
overflow:hidden;
padding-top:0px;
overflow:hidden;
}
本文介绍了解决模式对话框缓存导致无法获取最新记录的方法,通过在页面头部加入特定代码来清除缓存,并展示了如何正确加载服务器端控件以避免弹窗问题。此外,还提供了在选项卡中使用服务器端控件防止重置的解决方案。
4329

被折叠的 条评论
为什么被折叠?



