Click here to Skip to main content
16,004,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have one button inside datagrid. when i click on this button, it will open new window as popup.
when i click on close button from new window(child window),parent window(page) should refresh.

in parent grid, i have written code for button aspx page

XML
<asp:ButtonColumn HeaderText="" ButtonType="LinkButton" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"  HeaderStyle-Width="120px"     Text="<img src='../../images/ListOfProducts.gif' width=110   border=0/>"
CommandName="ProductsList"  />


C# code---------------

C#
protected void dgprod_ItemCommand(object Sender, DataGridCommandEventArgs e)
   {
       if (e.CommandName == "ProductsList")
       {


Response.Write("<script type='text/javascript'>window.open('Productspage.aspx?ID=" + e.Item.Cells[0].Text + "','height=80','width=1100','_blank');</script>");

       }



From child page while click on close button, i have written javascript
XML
<script type ="text/javascript">

        function CloseMe() {

            window.close();
        }
Posted

Add below line of code after window.close();.
JavaScript
window.opener.location.reload();


OR

JavaScript
<script>
        window.onunload = refreshParent;
        function refreshParent() {
            window.opener.location.reload();
        }
    </script>

Refer:http://forums.asp.net/t/1796992.aspx[^]
This may help.
 
Share this answer
 
v2
Comments
kamalsekhar 20-Jan-14 6:52am    
Hi Gitanjali,

its not woking.pls see in top, how i have written code
You may do this also; add this code on child close button

XML
<asp:ImageButton ID="btnClose" runat="server" ImageUrl="images/popup/close_bttn.png" OnClick="btnReload_Click" OnClientClick="$find('ChildPopupID').hide(); return false;" />

protected void btnReload_Click(object sender, EventArgs e)
    {
//call the controls which you want to load
}


Also put all the controls should be inside update panel.

Hope this might solve your problem.
 
Share this answer
 
v2
Comments
kamalsekhar 20-Jan-14 2:36am    
Hi,
I have this aspx code inside datagrid. i m using button column. i m not using asp:imagebutton
<asp:Datagrid>
<asp:ButtonColumn HeaderText="" ButtonType="LinkButton" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="120px" Text="<img src='../../images/ListOfProducts.gif' width=110 border=0/>"
CommandName="ProductsList" />

sahabiswarup 20-Jan-14 2:44am    
Then you may apply this
protected void dgprod_ItemCommand(object Sender, DataGridCommandEventArgs e)
{
if (e.CommandName == "ProductsList")
{
//hide child modalpopup
//call controls which you want to reload
}
}

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