Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
C#
<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>");


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
JavaScript
<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>


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

What I have tried:

i tried also
i add one more button
HTML
<pre lang="HTML"><pre>                    <input id="Button2"  type="button" value="Reset" />

try to create another funtion
HTML
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);
Posted
Comments
F-ES Sitecore 17-Aug-18 5:17am    
Use the debugger to inspect the value of "cpframe", is it null\undefined?
tastini 17-Aug-18 5:25am    
yes you are right cpframe is null ... this is the wrong line "var cpframe = top.document.getElementById('contframe');"?
Vincent Maverick Durano 17-Aug-18 9:17am    
How was your contframe declared? You need to use the actual ID generated when using getElementById
tastini 17-Aug-18 11:22am    
contframe is a iframe it is in masterpage.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900