关闭子窗口时,父页面不会刷新 [英] Parent page is not refreshing when closing the child winow
本文介绍了关闭子窗口时,父页面不会刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
场景 -
Scenario-
In Parent window : a gridview is there
column1 column2 column3
a b linkbutton1
c d linkbutton2
when clicked on linkbutton a child window popus up. i add something. And then close the child window[no button is made in child window to close..just normal close].
Again i click on linkbutton to check whether what i have added is there or not. but i dont find.
But if i log out completely from the application...again navigate to the parent page...and click on link button i find the thing that i added in child window is there...
--So is it like parent window is not refreshing when child window is closed. How to tackle this ? kindly help .
------------------------ -------------------------------------------------- -------------
---------------------------------------------------------------------------------------
Parent page code :
protected void gridShuttleAdmin_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//onmouse over and mouse out on the grid color changes
e.Row.Attributes.Add("onmouseover", "this.previous_color=this.style.backgroundColor;this.style.backgroundColor='PaleGreen'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=this.previous_color;");
Label lbltrip = (Label)e.Row.FindControl("lbltrip");
if (lbltrip != null)
{
Label lblshuttledetailname = (Label)e.Row.FindControl("lblshuttledetailname");
Label lblshuttlefacilityid = (Label)e.Row.FindControl("lblshuttlefacilityid");
Label lblfacilityid = (Label)e.Row.FindControl("lblfacilityid");
LinkButton lbtn = (LinkButton)e.Row.FindControl("lnkviewID");
lbtn.Attributes.Add("onClick", "var sFeatures='dialogHeight: 700px;dialogWidth: 1000px;'; window.showModalDialog('Shuttle_StopDetails.aspx?shuttlefacilityid=" + lblshuttlefacilityid.Text + "&facility=" + lblfacilityid.Text + "&Trip=" + lbltrip.Text + "','',sFeatures);window.document.forms[0].submit();");
}
}
}
--------------------------------child page------------------------------------------------
protected void gridShuttleDetails_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "AddNew")
{
int identityCreated;
TMS.Business.ShuttleStopDetails ObjShuttleStopdetails = new TMS.Business.ShuttleStopDetails();
TMS.API.ShuttleMaster.ShuttleMaster_IN objShuttleRouteManager = (TMS.API.ShuttleMaster.ShuttleMaster_IN)FillObjectFromScreen();
int index = gridShuttleDetails.Rows.Count - 1;
GridViewRow row = gridShuttleDetails.Rows[index];
var Departurtime = ((Label)row.FindControl("lblDeparture")).Text;
var lblFacilityNamecheck = ((Label)row.FindControl("lblFacilityName")).Text;
if (lblFacilityNamecheck != "" && (objShuttleRouteManager.Shuttle_Facility_Name == lblFacilityNamecheck))
{
//ScriptManager.RegisterStartupScript(Page, typeof(Page), "", "alert('" + System.Configuration.ConfigurationSettings.AppSettings["Facility_Check"].ToString() + "');", true);
ScriptManager.RegisterStartupScript(Page, typeof(Page), "", "alert('Please Enter A Different Facility')", true);
}
else
{
identityCreated = ObjShuttleStopdetails.Create(objShuttleRouteManager);
if (identityCreated > 0)
{
ScriptManager.RegisterStartupScript(Page, typeof(Page), "", "alert('" + System.Configuration.ConfigurationSettings.AppSettings["Save_Record"].ToString() + "');", true);
BindShuttleDetails();
UpdatePanel1.Update();
}
}
}
}
我在右上角关闭><儿童winow。
I am closing on top right >< of child winow.
推荐答案
请参阅我对该问题的评论。在客户端,您可以从子上的JavaScript对父浏览器窗口进行一些操作。要访问父窗口,您需要使用属性window.parent
:
http://www.w3schools.com/jsref/prop_win_parent.asp [ ^ ],
参见: http://www.w3schools.com/jsref/dom_obj_document.asp [ ^ ]。
这样,您就可以访问窗口及其文档
对象并直接操作父文档的DOM元素。
-SA
Please see my comment to the question. On the client side, you can do some manipulations on the parent browser window from the JavaScript on the child. To access a parent window, you need to use the propertywindow.parent
:
http://www.w3schools.com/jsref/prop_win_parent.asp[^],
see also: http://www.w3schools.com/jsref/dom_obj_document.asp[^].
This way, you can get access to window and itsdocument
object and directly manipulate DOM elements of the parent document.
—SA
请在父页面的javascript中写一个函数,重新加载页面。
示例:
函数reloadParent()
{
window.location.reload();
}
在您的子页面中只调用opener.reloadParent();在子页面中完成操作后在javascript中。
please write a function in javascript in parent page which will reload the page .
Example:
function reloadParent()
{
window.location.reload();
}
The in your child page just call opener.reloadParent(); in javascript after you finish your operation in child page.
这篇关于关闭子窗口时,父页面不会刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文