让showModalDialog显示修改后的记录,并点击服务器端控件后不弹出网页
要让弹出的模式对话框获得最新的记录,就需要清空模式对话框所在网页的缓存,以便能得到最新记录,这就需要在网页的<head></head>中间添加如下代码:
<
meta
http-equiv
="PRAGMA"
content
="NO-CACHE"
>
为了能够正常使用模式对话框中的服务器端控件,避免弹出网页的烦恼,在网页的标头中加如下代码:
<
base
target
="_self"
/>
完整代码如下:
<
head
runat
="server"
>
< title > 无标题页 </ title >
< meta http-equiv ="PRAGMA" content ="NO-CACHE" >
< script type ="text/javascript" language ="javaScript" src ="/_layouts/images/include/timein.js" ></ script >
< link href ="../CSS/style.css" rel ="Stylesheet" type ="text/css" />
< base target ="_self" />
</ head >
< title > 无标题页 </ title >
< meta http-equiv ="PRAGMA" content ="NO-CACHE" >
< script type ="text/javascript" language ="javaScript" src ="/_layouts/images/include/timein.js" ></ script >
< link href ="../CSS/style.css" rel ="Stylesheet" type ="text/css" />
< base target ="_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" >
< script language ="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 >
< style type ="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;
}
<% ... @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" >
< script language ="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 >
< style type ="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;
}