让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 >

      这样就解决了弹出对话框的问题了.还有在标签选项卡中使用服务器端控件防止选项卡重置的问题,代码如下:

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

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

<% @ Register Src="../CarAttemper/Controls/CarInfo.ascx" TagName="CarInfo" TagPrefix="uc1"  %>
<% @ Register Src="Controls/CarAllInfoControls/CarInfo.ascx" TagName="CarInfo" TagPrefix="uc2"  %>

<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< script  language ="JavaScript" >
//Switch Tab Effect
function switchTab(tabpage,tabid){
        
var oItem = document.getElementById(tabpage);   
    
for(var i=0;i<oItem.children.length;i++){
        
var x = oItem.children(i);    
        x.className 
= "";
        
var y = x.getElementsByTagName('a');
        y[
0].style.color="#333333";
    }
    
    document.getElementById(tabid).className 
= "Selected";
    
var dvs=document.getElementById("cnt").getElementsByTagName("div");
    
for (var i=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;
        }

      
else if(dvs[i].controlFlag == "yes")
        dvs[i].style.display
='none';
    }

}


function doInitTab(){
try{
    
var index = document.getElementById("ChosedIndexId").value;
    
var showDivName = "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.TabBarLevel1 li
{
    float
:left;
    padding
:0;
    height
:29px;
    margin-right
:1px;
    background
:url(Images/320066292748.gif) left top no-repeat;
}

ul.TabBarLevel1 li a
{
    display
:block;
    line-height
:29px;
    padding
:0 20px;
    color
:#333;
    background
:url(Images/w20066292815.gif) right top no-repeat;
    white-space
: nowrap;
}

ul.TabBarLevel1 li.Selected
{
    background
:url(Images/220066292838.gif) left top no-repeat;
}

ul.TabBarLevel1 li.Selected a
{
    background
:url(Images/42006629294.gif) right top no-repeat;
}


ul.TabBarLevel1 li a:link,ul.TabBarLevel1 li a:visited
{
    color
:#333;
}

ul.TabBarLevel1 li a:hover,ul.TabBarLevel1 li a:active
{
    color
:#F30;
    text-decoration
:none;
}

ul.TabBarLevel1 li.Selected a:link,ul.TabBarLevel1 li.Selected a:visited
{
    color
:#000;
}

ul.TabBarLevel1 li.Selected a:hover,ul.TabBarLevel1 li.Selected a:active
{
    color
:#F30;
    text-decoration
:none;
}

div.HackBox 
{
  padding 
: 2px 2px ;
  border-left
: 2px solid #6697CD;
  border-right
: 2px solid #6697CD;
  border-bottom
: 2px solid #6697CD;
  display
:none;
}

.table
{
   text-align
:left;
   width
:100%;
   border
:2px solid #ABCFFF;
}


.table td
{
 height
:22px;
 line-height
:22px;
 text-indent
:12px;
 border
:1px solid #ABCFFF;
 text-decoration
:none;
 overflow
:hidden;
 padding-top
:0px;
 overflow
:hidden;
}

.table td a
{
 white-space
:normal; 
 overflow
:auto;
 text-decoration
: none;
 color
:#264F7B;
}

.table td a:hover
{
 color
:#FF0000;
 text-decoration
:none;
 
}

.table th
{
 height
:23px;
 line-height
:23px;
 background-color
:#CDE7FE;
 border
:0px solid #ABCFFF;
 background-image
:url(/_layouts/images/images/di_03.gif);
 background-repeat
:repeat-x;
 font-weight
:normal;
 text-indent
:12px;
 color
:#000000;
}

.table th  a
{
 border-bottom
:none;
 height
:23px;
 line-height
:23px;
 text-align
:center;
 text-decoration
:none;
}

.table th  a:hover
{
 height
:23px;
 line-height
:23px;
 background
:#efefef;
}

.tr2
{
 background
:#DDEEFE;
}


</ style >

< link  href ="../CSS/style.css"  type ="text/css"   />
< body  style ="text-align: center"   >
    
< form  id ="form1"  runat ="server" >
< div  id ="Whatever" >
    
< ul  class ="TabBarLevel1"  id ="TabPage1" >
        
< li  id ="Tab1" >< href ="#"  onclick ="javascript:switchTab('TabPage1','Tab1');" >
            车辆基本信息
</ a ></ li >
        
< li   id ="Tab2" >< href ="#"  onclick ="javascript:switchTab('TabPage1','Tab2');" > 车辆年检信息 </ a ></ li >
        
< li   id ="Tab3" >< href ="#"  onclick ="javascript:switchTab('TabPage1','Tab3');" > 车辆维修信息 </ a ></ li >
        
< li   id ="Tab4" >< href ="#"  onclick ="javascript:switchTab('TabPage1','Tab4');" > 车辆油耗信息 </ a ></ li >
    
</ ul >
    
< div  id ="cnt" >
    
< div  id ="dTab1"  choseIndex ="1"  class ="HackBox"  controlFlag ="yes"   >
        
< uc2:CarInfo  ID ="CarInfo1"  runat ="server"   />
        
&nbsp;&nbsp;&nbsp;&nbsp;
    
</ div >
    
< div  id ="dTab2"  choseIndex ="2"  controlFlag ="yes"  class ="HackBox" >
        
< uc3:CarYearCheckInfo  ID ="CarYearCheckInfo1"  runat ="server"   />
    
</ div >
    
< div  id ="dTab3"  choseIndex ="3"  controlFlag ="yes"  class ="HackBox" >
        
< uc4:CarMaintainInfo  ID ="CarMaintainInfo1"  runat ="server"   />
    
</ div >
    
< div  id ="dTab4"  choseIndex ="4"  controlFlag ="yes"  class ="HackBox" >
        
< uc5:CarOilInfo  id ="CarOilInfo1"  runat ="server" >
        
</ uc5:CarOilInfo >
    
</ div >
</ div >
        
< input  id ="ChosedIndexId"  type ="hidden"  value ="1"  runat ="server" /> &nbsp; </ div >

</ form >
< script  language ="javascript" >
window.onload 
= doInitTab;
</ script >
</ body >
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值