locked
Ajax Toolkit ModalPopup control RRS feed

  • Question

  • User-629681371 posted

    I have used modalpopup extender tool for confirmation message for deleting something

    when user clicks on popup ok button i want to hide the popup and continue my code execution for delete 

    how to do this..

    Wednesday, August 13, 2014 2:32 AM

Answers

  • User1918509225 posted

    Hi Smitha57,

    Thanks for your post here.

    I suggest that you can remove   OkControlID property  in your modal extender.

    Then add a button control in your modal panel .add click event  for the control.

    When you click the button, it will  fire post back. and your modal will disappear  after post back.

    You can execute your code for delete in your button event.

    Best Regards,

    Kevin Shen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 14, 2014 5:15 AM

All replies

  • Wednesday, August 13, 2014 3:43 AM
  • User1918509225 posted

    Hi Smitha57,

    Thanks for your post here.

    I suggest that you can remove   OkControlID property  in your modal extender.

    Then add a button control in your modal panel .add click event  for the control.

    When you click the button, it will  fire post back. and your modal will disappear  after post back.

    You can execute your code for delete in your button event.

    Best Regards,

    Kevin Shen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 14, 2014 5:15 AM
  • User724169276 posted

    Hello Smitha,

    Create a fake button of below markup:

    <asp:button id="hButton" runat="server" style="display:none;" />

    and use above button as target control id as its mandatory in modal popup extender.

    then see below:

    <asp:Button runat="server" ID="btnAdd" Text="Add" OnClick="btnAddClick" />
      <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="hButton"
      PopupControlID="Panel1" Drag="true" BackgroundCssClass="ModalPopupBG" >
      </cc1:ModalPopupExtender>

    Above point of interest is the TargetControlID which has a fake button associated which is invisible.so now on btnADD button on click you can show your popup and do your stuff without any prblem:

    protected void btnAddClick(object sender, EventArgs e)
            {
                ModalPopupExtender1.Show();        
            }

    And you can use Hide() property of the modalpopup to hide wherever you want it to.

    Source Here.

    Feel free to ask any question(s). (if any).

    Hope It Helped. :)

    Thursday, August 14, 2014 6:50 AM