让showModalDialog显示修改后的记录,并点击服务器端控件后不弹出网页

本文介绍了解决模式对话框缓存导致无法获取最新记录的方法,通过在页面头部加入特定代码来清除缓存,并展示了如何正确加载服务器端控件以避免弹窗问题。此外,还提供了在选项卡中使用服务器端控件防止重置的解决方案。

要让弹出的模式对话框获得最新的记录,就需要清空模式对话框所在网页的缓存,以便能得到最新记录,这就需要在网页的<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;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值