ASP.NET - submit and close modal popup window
Asked By Anandh Ramanujam
10-Feb-12 09:27 AM
hi
Iam opening a modal popup window from an aspx page.
in modal popup, if i click server side button, perform some db changes and should close the window...
Here the code i have written:
in button_click event:
performing some db operations....
....
....
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", "javascript:window.close()", true);
But it doesnt work well. What happens is, when i click the button, it opens the same page in another new window, and prompt us 'are u want to close this window yes/no'. and the modal popup remains still.
Can u pls help me in this regard
thanks
Suchit shah replied to Anandh Ramanujam
Try it on this way
protected void btn_save(object sender, eventargs e)
{
// Here you can do your DB operation and now follow below way to close itt
string scriptKey = "RefreshParentScript";
string javaScript = "refreshParent();";
ClientScript.RegisterStartupScript(this.GetType(), scriptKey, javaScript, true);
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", "javascript:window.close()", true);
}
alot var Hi What are Master Pages in ASP.NET? or What is a Master Page? ASP.NET master pages allow you to create a consistent layout for the pages in your application. A single master page defines the look and feel and standard behavior that you want for all of the you want to display. When users request the content pages, they merge with the master page to produce output that combines the layout of the master page with the content from the content page. What are the 2 important parts of a master page? The following are the 2 important parts of a master page 1. The Master Page itself 2. One or more Content Pages Can Master Pages be nested? Yes, Master Pages
Page Directive? What is the purpose of page directive in aspx page? Directive Syntax Directives are instructions used to specify settings (related to how a page should render and processed) used by the page and user control compilers when they process ASP.NET Web Forms page (.aspx) and user control (.ascx) files. These are the essential part of every ASP.NET Page or Control. Directives can be located anywhere in an .aspx or .ascx file, but the values, same as any HTML tag) that are specific to that directive. Special Note: The @ Page directive can be used only in .aspx files, and the @ Control directive can be used
Remove(e.TabPage); } _cache.Add(e.TabPage); } } private void button1_Click(object sender, EventArgs e) { TabPage page = new TabPage("TabPage" + pageNumber.ToString()); AddControlsToTabPage(page); this.tabControl1.TabPages.Add(page); pageNumber++; this.tabControl1.SelectedTab = page; } private void AddControlsToTabPage(TabPage page) { page.Controls.Add(this.tab1CheckBox1); page.Controls.Add(this.tabCheckBox2 page.Controls.Add(this.tabCheckBox3); page.Controls.Add(this.tabCheckBox4); page.Controls.Add(this.tabCheckBox5); page
Utilities; using System.Text.RegularExpressions; using System.Net; public partial class Production_OA_Config : System.Web.UI.Page { #region Public Variables & Objects ExceptionHandler objHandlers; OAEntity _oaEntity = new OAEntity(); List<object> obj = new List PnlAutomated.ClientID + "').style.display = 'none';return false;"); / / * ** * / / ChkOA_Number_Availability.Attributes.Add("onclick", "if(!) return false; "); ScriptManager.RegisterStartupScript(this, this.GetType(), "", "Initial_Setting();showwarning();", true); / / ScriptManager.RegisterStartupScript(this, this.GetType(), "popup message", "setconformation();setScrollerWidth();slidStart();", true); if (CadPartListpopUp ! = null) { / / ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "cadpop", "document.getElementById('" + CadPartListpopUp.ClientID + "').style.display = '';ShowBackShadow('dvbackShadow', true);", true); } } catch ExceptionHandler ex) { ErrorHandler.SetMessage(ex.MessageDetails(), spnmessage); / / ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "popup message", "document.getElementById('" + ErrorPop.ClientID + "').style.display = '';", true); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "popup message", "Message_MoveTO_popup('" + spnmessage.ClientID + "', 'spnmessage');JqueryPopupShow();", true); } catch (Exception ex) { objHandlers new ExceptionHandler(ex, true); ErrorHandler.SetMessage(objHandlers.MessageDetails(), spnmessage); / / ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "popup message", "document.getElementById('" + ErrorPop.ClientID + "').style.display = '';", true); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "popup message", "Message_MoveTO_popup('" + spnmessage.ClientID + "', 'spnmessage');JqueryPopupShow();", true); } } private void BindActor() { / / ddlCustomer