Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

How to Hide Ajax modal popup extender from code behind

$
0
0

My .aspx page has source code like below

<script type="text/javascript" language="javascript">

function HideModalPopup() {
$find("ModalBehaviour").hide();
}

</script>

<asp:LinkButton ID="lnkSave" runat="server" OnClick="lnkSave_Click">Save</asp:LinkButton>

<asp:HiddenField ID="hdnForModel" runat="server" />


<ajaxToolkit:ModalPopupExtender ID="modelPopUpWarning" runat="server"
PopupControlID="pnlOkCancel"
TargetControlID="hdnForModel"
BehaviorID ="ModalBehaviour"
BackgroundCssClass="modalBackground"
DropShadow="false"
CancelControlID="btnPopUpCancel">
</ajaxToolkit:ModalPopupExtender>

<asp:Panel ID="pnlOkCancel" runat="server" CssClass="modalPopup" Width="57%" Height="17%" style="display:none">

<div style="float:none; width: 300px; height: 40px; padding-top: 15px; padding-left: 35px;">
<asp:Label ID="lblWarning" runat="server"></asp:Label>
</div>
<div style="width: 300px; padding-top: 5px; padding-left: 40%; ">
<asp:Button ID="btnPopUpOk" runat="server" Text="Yes" Width="60px" OnClientClick = "HideModalPopup()" OnClick="btnPopUpOk_Click" />
<asp:Button ID="btnPopUpCancel" runat="server" Text="No" Width="60px" /></div>


</asp:Panel>

I'm Calling modal popup from my Code behind file

protected void lnkSave_Click(object sender, EventArgs e)
{

////I execute some code and I'l get some result

modelPopUpWarning.Show();

lblWarning.Text = "This is"+result+"You want to continue";

}

//////////On click of yes button of the pop up I want to execute my next set of code.

protected void btnPopUpOk_Click(object sender, EventArgs e)
{

///// I want to hide the pop up and continue my execution

////   Code

}

Before using BehaviorID  in modal pop up it was executing properly but pop up was not hiding.

I got to know about BehaviorID  to hide the pop up using Javascript..

So I wrote Javascript  and called from pop up yes button onclient click.

Now Im getting 

Object reference not set to an instance of an object. 

Exception in the following line

protected void lnksave_Click(object sender, EventArgs e)
{

modelPopUpWarning.Show();

What is the problem.How to meet my expectation.

I want to hide the pop up on click of Pop up Yes button and continue the execution part on that button.

Please help me in this regard


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>