If you are using ModalPopup extender to binding a control that will do postback, you'll consider that either the popup won't open or the control's event at code behind won't happen. This is because when you the popup comes up, it cancel the control's postback.
You may try using update panel to wrap your control. when it is working at code behind, use javascript to show the modalpopup.
take a fake button and set it as TargetControlID of the modal popupand set it style="display:none" to make it invisble.. now on the main button on which u want to show the popup write in code behind on its click event the following code after u have filied
ur modal popup panel..
Thanx 4 d reply. it solves my problem..nw i m facing another problem. I have taken a dropdown inside modalpopup extender and want to clear it each time when the modalpopup opnes. can anybody help me??
raji539
Member
46 Points
25 Posts
How to Call ModelPopUp Target Control Button Code Behind Code
May 23, 2011 11:29 AM|LINK
<Ajax:ModalPopupExtender runat="server" ID="MPCForInfo" TargetControlID="btnUpdate" PopupControlID="pnlInfo" Enabled="true" DropShadow="true" CancelControlID="btnMPCancel" BackgroundCssClass="ModelPopUpBGStyle" > </Ajax:ModalPopupExtender>in btnUpdate click event i have lot back end code to do
protected void btnSubmit_Click(object sender, EventArgs e) { string strlog = string.Empty; DataSet ds = null; TextBox myTextBox = WIPObjects.FindControl("txtMainFile") as TextBox; strMainFileName = myTextBox.Text; TextBox SVNPath = WIPObjects.FindControl("txtSvnFolderPath") as TextBox; strSVNPath = SVNPath.Text; }when i use btnUpdate as a modelpopUp target control then the back end code is not executing.
My requirement is, the back end code is running 2 or 3 minutes meanwhile i need to some information about progress
i tried target control as a pnlInfo then the panel displaying two one as model popup and another one is in page and cancel button also not working ..
Can any one give me solution for the ....
Thanks in advance
Rajesh Kumar Chekuri
http://www.funevil.blogspot.com
http://techtasks.net
karthicks
All-Star
31382 Points
5424 Posts
Re: How to Call ModelPopUp Target Control Button Code Behind Code
May 23, 2011 11:44 AM|LINK
hi,
you can show popup in code-behind using
modalpopupExtender1.Show()
use label set style=display:none
set TargetControlID="label1" (dont set TargetControlID as button, then you can't execute click event)
in btnSubmit_Click call
modalpopupExtender1.Show()
Karthick S
chetan.sarod...
All-Star
65839 Points
11163 Posts
Re: How to Call ModelPopUp Target Control Button Code Behind Code
May 24, 2011 02:51 AM|LINK
Hi, Please refer this
http://mattberseth.com/blog/2007/07/modalpopup_as_an_ajax_progress.html
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
BU XI - MSFT
All-Star
22367 Points
2704 Posts
Microsoft
Re: How to Call ModelPopUp Target Control Button Code Behind Code
May 26, 2011 05:07 AM|LINK
Hello
If you are using ModalPopup extender to binding a control that will do postback, you'll consider that either the popup won't open or the control's event at code behind won't happen. This is because when you the popup comes up, it cancel the control's postback.
You may try using update panel to wrap your control. when it is working at code behind, use javascript to show the modalpopup.
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework
meherzad4u
Member
294 Points
58 Posts
Re: How to Call ModelPopUp Target Control Button Code Behind Code
May 26, 2011 05:19 AM|LINK
take a fake button and set it as TargetControlID of the modal popupand set it style="display:none" to make it invisble.. now on the main button on which u want to show the popup write in code behind on its click event the following code after u have filied ur modal popup panel..
modalpopup.show();
the show() method will open the popup
contact if there is any further problem
madan535
Contributor
3217 Points
1179 Posts
Re: How to Call ModelPopUp Target Control Button Code Behind Code
May 26, 2011 05:32 AM|LINK
<asp:UpdatePanel ID="updPnlMapUpdate" runat="server" UpdateMode="Conditional"> <ContentTemplate> <div class="map_form"> <asp:Button ID="btnGo" runat="server" Text="Go" onclick="btnGo_Click" /> </div> <cc1:ModalPopupExtender ID="mdlGoogleMapGo" runat="server" BehaviorID="mdlPopup1" TargetControlID="btnGo" PopupControlID="divGoogleMapGo" BackgroundCssClass="ModalPopupBG" DynamicServicePath="" Enabled="True"> </cc1:ModalPopupExtender> </ContentTemplate> </asp:UpdatePanel>protected void btnGo_Click(object sender, EventArgs e) { this.updPnlMapUpdate.Update(); show the modal popup this.mdlGoogleMapGo.Show(); }divyajsinha
Member
11 Points
10 Posts
Re: How to Call ModelPopUp Target Control Button Code Behind Code
Jun 01, 2011 06:54 AM|LINK
karthicks
All-Star
31382 Points
5424 Posts
Re: How to Call ModelPopUp Target Control Button Code Behind Code
Jun 01, 2011 07:02 AM|LINK
Karthick S
divyajsinha
Member
11 Points
10 Posts
Re: How to Call ModelPopUp Target Control Button Code Behind Code
Jun 01, 2011 07:24 AM|LINK