我有两个aspx文件,用于向销售/从销售中添加/删除产品。
我在islemler.aspx中有一个islemler.aspx,当在islemlerGridView上选择一行按钮时,这个GridView的名称是islemlerGridView,而这个按钮的名称是islemDetayGorButton。
单击islemDetayGorButton时,将打开SatisTedarik.aspx。在SatisTedarik.aspx上有许多元素,例如标签、文本框、下拉列表、网格视图,通过这个SatisTedarik.aspx窗口,用户可以添加/删除销售产品(销售以islemlerGridView显示)。
我需要做的是,当有关出售的东西通过SatisTedarik.aspx改变时,更新SatisTedarik.aspx。
我找到了这个问题,将值从弹出窗口传递给父窗体的TextBox,并尝试了一些与JavaScript,我不得不说,我没有JavaScript的经验。我尝试刷新打开窗口,在我的条件下,opener窗口是islemler.aspx,我在SatisTedarik.aspx上使用了以下代码:
<script type="text/javascript">
function f2() {
opener.document.getElementById("TextBox1").value = "hello world";//this is just from that example in the link
opener.document.location.reload(true);//that is how I refresh islemler.aspx
}
</script> 这是使用f2()的按钮
<input type="button" value="return hello world" onclick="f2();" />是的,这段代码刷新了islemler.aspx,但是通过SatisTedarik.aspx生成的恒流没有反映在islemlerGridView上。
例如,
islemlerGridView显示销售id和销售总金额。islemlerGridView和islemDetayGorButton出现,然后我点击这个按钮,它打开SatisTedarik.aspx。最后,我点击使用f2()的按钮,它刷新了islemler.aspx,但是sale X的销售总金额仍然是10元,但是我需要它是15元,因为我在那次销售中添加了一个新产品。
所以我的第一个问题是我该怎么做才能得到预期的result?(solved)
问:,第二,我是否可以只刷新islemlerGridView,而不能刷新整个页面?
好的,这是我的第一个问题,,
window.opener.location.href = window.opener.location.href; 所以我的第一个问题现在有了答案。
问:有没有办法只刷新,而不能刷新整个页面?
(我尝试了IE9和4中的所有版本)
我查过的链接找到了一些好的东西:
发布于 2011-05-30 14:08:53
我创建了一个名为UpdatePanel的GridRefreshPanel,并将网格放入该面板并使用
function f2() {
window.opener.__doPostBack('GridRefreshPanel.ClientID', '');
//window.opener.__doPostBack('islemlerGridView.ClientID', ''); //this is also working without GridRefreshPanel
} 发布于 2011-05-27 10:03:59
function ReloadParent()
{
if (window.parent)
{
window.parent.location.replace(window.parent.location.href);
}
}此代码将从您的子页面重新加载您的父页面……
https://stackoverflow.com/questions/6149938
复制相似问题