show ajax modal popup from code behind, after succesfully inserting a record in db

On a button click, I execute server side code to insert a record in the db, after that I want to show a ajazmodal popup. how can i show form code behind using c#.net. please help thanks
TrialUserAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ddayx10Commented:
ModalpopupextenderID.Show();
0
TrialUserAuthor Commented:
That does not work, for some reason.
<asp:LinkButton ID="lnk" runat="server" Visible ="false"></asp:LinkButton>
     <ajax:modalpopupextender ID="mpeSuccess" runat="server"
        PopupControlID="pnlSuccess" TargetControlID="lnk"
        OkControlID="OKbtn" BackgroundCssClass="modalBackGround" runat="server" DropShadow="true"></ajax:modalpopupextender>
    <asp:Panel ID="pnlSuccess" runat="server" CssClass="pnlmodalbgLegend" DefaultButton="OKbtn" style="display:none;">

Code behind :
       mpeSuccess.Show();
0
ddayx10Commented:
U using an updatepanel
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

ddayx10Commented:
That is the proper method and usage. I see nothing in your posted code to stop it from functioning.

If you're modalpopupextender is in an updatepanel or one of its components is a trigger for an updatepanel this would explain it not working. Or if you are fiddling with showing and hiding the modal in any other code(javascript etc) you may want to make sure its not interfering.

If you're using an update panel then you put something like this in your btn_click server side event to call your modal. <see code>

You need to assign a BehaviorId to your modalpopupextender for this to work.

ScriptManager.RegisterClientScriptBlock Method
http://msdn.microsoft.com/en-us/library/bb350750.aspx
'Note this is not the id of the scriptmanager as an object on the front end
'Its just ScriptManager
'Note this only fires when the trigger performs a partial page postback
ScriptManager.RegisterClientScriptBlock(BtnTrigger, GetType(Button), "PartialOnlyScript", "$find('modalpopupbehaviorid').show();", True)

Open in new window

0
TrialUserAuthor Commented:
I am not using an update panel, but Icant get the panel to show.

this is the code i have right now
 <ajax:modalpopupextender ID="mpeSuccess" BehaviorID="mpeBehaviour" runat="server"
        PopupControlID="pnlSuccess" TargetControlID="lnk"
        OkControlID="OKbtn" BackgroundCssClass="modalBackGround"  DropShadow="true"></ajax:modalpopupextender>
    <asp:Panel ID="pnlSuccess" runat="server" CssClass="pnlmodalbg" DefaultButton="OKbtn" style="display:none;">
       
            <div style="float:right; margin-top:-20px; margin-bottom:0px; margin-left:20px; margin-right:-30px; cursor:pointer;">  
                <asp:Image ID="imgClosePopup" runat="server" AlternateText="Close [ X ]" ImageUrl="/Assets/Images/ProductDetails/CloseModalPopup.png" OnClientClick="$find('ModalPopupExtender1').hide(); return false;"/>
            </div>
           <div>
            success
            <asp:Button ID="OKbtn" runat="server" Text="Close" />
           </div>                                        
    </asp:Panel>
0
ddayx10Commented:
Try this instead:


<asp:Button ID="Button1" runat="server" Text="UpdateOpenModal" 
		onclick="Button1_Click" />
	<asp:LinkButton ID="lnk" runat="server" style="display:none;"></asp:LinkButton>
     <ajax:modalpopupextender ID="mpeSuccess" runat="server" 
        PopupControlID="pnlSuccess" TargetControlID="lnk"
        OkControlID="OKbtn" BackgroundCssClass="modalBackGround" DropShadow="true"></ajax:modalpopupextender>
	<asp:Panel ID="pnlSuccess" runat="server" CssClass="pnlmodalbg" DefaultButton="OKbtn"
		Style="display: none;">
		<div style="float: right; margin-top: -20px; margin-bottom: 0px; margin-left: 20px;
			margin-right: -30px; cursor: pointer;">
			<asp:Image ID="imgClosePopup" runat="server" AlternateText="Close [ X ]" ImageUrl="/Assets/Images/ProductDetails/CloseModalPopup.png"
				OnClientClick="$find('ModalPopupExtender1').hide(); return false;" />
		</div>
		<div>
			success
			<asp:Button ID="OKbtn" runat="server" Text="Close" />
		</div>
	</asp:Panel>

Open in new window

protected void Button1_Click(object sender, EventArgs e)
    {
        mpeSuccess.Show();
    }

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.