调用另一个页面按钮单击事件ASP.NET C# [英] Call another page button click event ASP.NET C#

查看:66
本文介绍了调用另一个页面按钮单击事件ASP.NET C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个母版页和一些网页。 Page1有一个gridview并在其上填充一些数据,它在gridview一侧有添加和编辑按钮。一旦我点击添加/编辑按钮,它将打开代码在下面的弹出窗口

i got a master page and some web pages on this. Page1 have one gridview and populating some data on that and it has add and edit button on the side of gridview. once i click the add/edit button it will open the popup window the code is below

<pre> ImageButton btnEdit = (ImageButton)sender;
            GridViewRow row = (GridViewRow)btnEdit.NamingContainer;
            string url;
            url = "Add-Leave.aspx?a=E&id=" + txtEmployeeCode.Text.Trim() + "&acc=" + ((HiddenField)row.FindControl("hidRecID")).Value + "&year=" + ((HiddenField)row.FindControl("hidYear")).Value;
            Response.Write("<script>window.open('" + url + "',400,600);</script>");

<添加/更新数据后,我想更新page1 gridview。






我尝试在page1中创建btnrefresh并为gridview创建数据绑定。我尝试从pupop窗口调用此按钮,如下所示



once the data is added/updated , i want to update the page1 gridview.

i try to create the btnrefresh in page1 and make databind for the gridview. i try to call this button click from pupop window as below

<pre> <div id="dvScript" runat="server">
        <script type="text/javascript">
            $(document).ready(function () {
                var cpframe = top.document.getElementById('contframe');
                if (cpframe) {
                    cpframe.contentWindow.document.getElementById('cphMain_btnRefresh').click();
                }
            });
        </script>
    </div>





它没有更新或发出任何错误。

感谢您的支持



我的尝试:



i也尝试了

i再添加一个按钮



it is not updating or giving any error.
thanks for the support

What I have tried:

i tried also
i add one more button

<pre lang="HTML"><pre>                    <input id="Button2"  type="button" value="Reset" />



尝试创建另一个函数


try to create another funtion

function refresh() {
               var cpframe = top.document.getElementById('contframe');
               if (cpframe) {
                   cpframe.contentWindow.document.getElementById('cphMain_btnRefresh').click();
               }
           }
           $(document).ready(function () {
               $("#Button2").click(function () {
                   refresh();
               });
           });



按钮后面的代码保存点击()


code behind on the button save click()

Page.ClientScript.RegisterStartupScript(this.GetType(), "reset", " refresh();", true);

推荐答案

document )。ready( function (){
var cpframe = top。 document .getElementById(' contframe');
if (cpframe){
cpframe.contentWindow。 document .getElementById(' cphMain_btnRefresh')。click();
}
} );
< / script>
< / div >
(document).ready(function () { var cpframe = top.document.getElementById('contframe'); if (cpframe) { cpframe.contentWindow.document.getElementById('cphMain_btnRefresh').click(); } }); </script> </div>





它没有更新或发出任何错误。

感谢您的支持



我的尝试:



i也尝试了

i再添加一个按钮



it is not updating or giving any error.
thanks for the support

What I have tried:

i tried also
i add one more button

<pre lang="HTML"><pre>                    <input id="Button2"  type="button" value="Reset" />



尝试创建另一个函数


try to create another funtion

function refresh() {
               var cpframe = top.document.getElementById('contframe');
               if (cpframe) {
                   cpframe.contentWindow.document.getElementById('cphMain_btnRefresh').click();
               }
           }


(document).ready(function(){
(document).ready(function () {


(#Button2)。click (function(){
refresh();
});
});
("#Button2").click(function () { refresh(); }); });



按钮后面的代码保存点击()


code behind on the button save click()

Page.ClientScript.RegisterStartupScript(this.GetType(), "reset", " refresh();", true);


这篇关于调用另一个页面按钮单击事件ASP.NET C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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