Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide the ASPxPopupControl from code behind

I have added an ASPxPopupControl, which includes a Save Button, and I want to close it after saving a record.

I tried the following:

 string str = @"<script language=""javascript"" type=""text/javascript"">function HideEscalateAsk() {pcEscalteAsk.Hide();}</script>";
                   Page.RegisterClientScriptBlock("ClientScript", str);

but it still doesn't work. How can I close the ASPxPopupControl?

like image 915
ghanshyam.mirani Avatar asked Jan 07 '12 12:01

ghanshyam.mirani


1 Answers

First thing. How are you handling Save Button; Server Side event or Client Side.

If you are using client side then use Callback server side event to save data and End Callback client event to close popup.

If using Server Side event then use ASPxPopupControl.ShowOnPageLoad Property.

protected void btnShowPopup_Click(object sender, EventArgs e) {
            txtPopup.Text = txtMain.Text;
            ASPxPopupControl1.ShowOnPageLoad = true;
        }
        protected void btnOK_Click(object sender, EventArgs e) {
            // TODO: your code is here to process the popup window's data at the server
            txtMain.Text = txtPopup.Text;
            ASPxPopupControl1.ShowOnPageLoad = false;
        }

Refer following links for information:
How to show the ASPxPopupControl
How to show and hide a popup window via server side code

like image 131
Niranjan Singh Avatar answered Oct 12 '22 23:10

Niranjan Singh