从另一个表单刷新表单 [英] refresh a form from another form

查看:109
本文介绍了从另一个表单刷新表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个包含4个面板的表格 - 他们在加载每个面板时使用服务器端的参数。

在第一个3-我点击一个按钮(我可以从同一个面板中的几个按钮中选择),在最后一个按钮上有一个表格,其中详细介绍了我之前点击过的按钮。



现在,我希望每当我改变另一种形式的东西时,它会自动刷新第一个(我需要在最后一个面板上看到表中的变化)。

只是为了清楚 - 我不想重新加载页面但只是为了刷新它。



我使用window.opener .location.reload()但我得到一个messegebox说:

如果不重新发送信息,页面就无法刷新。点击重试再次发送信息。



我在网上寻找解决方案之后,我找不到一个能够刷新页面而不显示此信息的解决方案。



在某些时候,我在表格中添加了方法=get< form id =form1runat =servermethod =get>并且messege停止显示但是现在当我想选择点击另一个按钮我不能发布....



所以..你能帮助我吗? ?

也许有另一种方式,而不是使用面板/更新面板,也没有以不同的形式打开桌子?





谢谢

Hi,

I have a form with 4 panels in it - and they are using parameters from serverside when loading each one.
On the first 3- I click on a button (I can choose from several buttons in the same panel) and on the last one there''s a table with details relaying on the buttons I clicked before.

Now, I want that whenever I change something in another form, it will automatically refresh the first one (I need to see the change in the table on the last panel).
Just to be clear - I don''t want to reload the page but only to REFRESH it.

I used window.opener.location.reload() but I''m getting a messegebox saying:
"The page cannot be refreshed without resending the information. Click Retry to send the information again".

After I looked all over the net for a solution, I can''t find a solution that will allow refreshing the page and not showing this messege.

At some point I added in the form method="get" <form id="form1" runat="server" method="get"> and the messege stopped showing but now when I want to choose to click another button I can''t do post....

So .. can you help me?
maybe there''s another way than using panel / update panel and also not openning the table in a different form??


thanks

推荐答案

使用计时器间隔1,所以它每1秒刷新一次数据......



use timer interval 1 so it refresh your data every 1 second...

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim connectionstring As String = "Driver=MySQL ODBC 3.51 Driver;Server=localhost;port=3306;uid=root;pwd=admin;Database=elcott;"
        Dim conn As New OdbcConnection(connectionstring)
        conn.Open()
        Dim da As New OdbcDataAdapter("select * from Userpass where Username like '%" & txSearch.Text & "%'", conn)
        Dim ds As New DataSet
        da.Fill(ds)
        DataGridView1.DataSource = ds.Tables(0)

        Dim da1 As New OdbcDataAdapter("select * from logs where Username like '%" & txSearch.Text & "%'", conn)
        Dim ds1 As New DataSet
        da1.Fill(ds1)
        DataGridView2.DataSource = ds1.Tables(0)
        conn.Close()
    End Sub


比我希望的更复杂,但最终我把我的孩子形成这个脚本,引用我母表上的方法:



More complicated than I wish to, but eventually I put on my child form this script that refer to a method on my parent form:

window.opener.createpostbackbyclick();





然后,在我的父表单上,我添加了一个不可见的按钮onclick ,更新我的面板,然后刷新页面。然后我从我创建的方法中点击(我在子表单上调用的那个)



首先我创建的方法:





then, on my parent form I added an inivisible button that onclick, update my panel and by that, refresh the page. And the I do the click from the method I created (the same one I called on the child form)

first the method I created:

function createpostbackbyclick()
{
document.getelementbyid("btnclick").click();
}





然后是按钮:





then the button:

<asp:button id="btnclick" runat="server" onclick="refreshme" visible="false" xmlns:asp="#unknown" />





和函数:





and the function:

function refreshme()
{
netpanel.update();
}





我还必须使用session来获取我的参数但总而言之 - 它现在可以使用



I also had to use session for my parameters but all in all - it works now


Page.Response.Redirect(Page.Request.Url.ToString(),true);
Page.Response.Redirect(Page.Request.Url.ToString(), true);


这篇关于从另一个表单刷新表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆