//主程序main.aspx脚本
<script type='text/javascript' language="javascript">
function OpenTab(tabID, url, title) {
var mainTabStrip = Ext.getCmp('<%= mainTabStrip.ClientID %>');
var currentTab = mainTabStrip.getTab(tabID);
if (!currentTab) {
mainTabStrip.addTab({
'id': tabID,
'url': url,
'title': title,
'closable': true,
'bodyStyle': 'padding:0px;'
});
} else {
mainTabStrip.setActiveTab(currentTab);
//var iframe = Ext.DomQuery.selectNode('iframe', mainTabStrip.getActiveTab().body.dom);
//iframe.src = url;// iframe.src;
}
}
</script>
//在要打开其它子网页程序中添加脚本
<script type="text/javascript">
function openHelloExtAspNet() {
var nID = '<%= ID.ClientID %>';
var mID = Ext.get(ntbxID).dom.value;
var murl = "K_Search/K_CZJQ_Search.aspx?ID=" + mID;
var tabID = 'dynamic_added_tab61';
OpenTab(tabID, murl, "XXXXX查询");
__doPostBack('SetSessionPostBack_ID', mID);
}
function OpenTab(tabid, url, title) {
parent.OpenTab(tabid, url, title);
}
</script>
//在要打开其它子网页程序Page_Load中添加
protected void Page_Load(object sender, EventArgs e)
{
this.ClientScript.GetPostBackEventReference(this, string.Empty);
if (!IsPostBack)
{
//...................
HttpContext.Current.Session["ID"] = "";
}
else
{
string eventTarget = (this.Request["__EVENTTARGET"] == null) ? string.Empty : this.Request["__EVENTTARGET"];
string eventArgument = (this.Request["__EVENTARGUMENT"] == null) ? string.Empty : this.Request["__EVENTARGUMENT"];
if (eventTarget == "SetSessionPostBack_ID")
HttpContext.Current.Session["ID"] = eventArgument;
}
}
//在子网页程序中增加定时器检测Session["ID"]变化,如Session["ID"]不为空,且与旧的ID不同,且重新检索数据,刷新部分页面
protected void Timer1_Tick(object sender, EventArgs e)
{
Timer1.Enabled = false;
mID = "";
if (HttpContext.Current.Session["ID" ] != null)
{
mID = (string)HttpContext.Current.Session["ID"].ToString();
} else mID = Request.Params["ID"];
if (mID == null) mID = "";
if (mID != "" && mID != oldID.Text)
{
ldID.Text= mID;
Grid_.PageIndex = 0;
Bind_Grid_();//重新绑定数据
HttpContext.Current.Session["ID"] = "";
}
Timer1.Enabled = true;
}
//这种方式比整个页面刷新效率要高 |