justin_smith
asked on
ModalPopupExtender with Async callback
Hi,
I am trying to use ModalPopupExtender as way to disallow the user from interacting with the site while a DB activity is completed.
I have a different requirement from what is specified in the ASP.NET sample for the AJAX Toolkit control..
This is what i want to do..
Show() the modalpopup
do the DB stuff asynchronously with BeginInvoke by pass the a method that hides modalpopup
I cant get this to work even after 4/5 hours of effort..
Logically i dont see why this shouldnt work...
Can someone give me some advice and provide some code samples
Thanks
I am trying to use ModalPopupExtender as way to disallow the user from interacting with the site while a DB activity is completed.
I have a different requirement from what is specified in the ASP.NET sample for the AJAX Toolkit control..
This is what i want to do..
Show() the modalpopup
do the DB stuff asynchronously with BeginInvoke by pass the a method that hides modalpopup
I cant get this to work even after 4/5 hours of effort..
Logically i dont see why this shouldnt work...
Can someone give me some advice and provide some code samples
Thanks
Could you provide some code for us to look at?
ASKER
I still dont understand
what the following mean anyway
BehaviorID="programmaticMo dalPopupBe havior"
TargetControlID="hiddenTar getControl ForModalPo pup"
what the following mean anyway
BehaviorID="programmaticMo
TargetControlID="hiddenTar
///This is in the desing mode
//This is the check box the user will click to trigger modal popup. refer code behind
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" OnCheckedChanged="CheckBox1_CheckedChanged" />
//Everthing below is for Modal popup
<asp:Button runat="server" ID="hiddenTargetControlForModalPopup" style="display:none"/>
<ajaxToolkit:ModalPopupExtender runat="server" ID="programmaticModalPopup"
BehaviorID="programmaticModalPopupBehavior"
TargetControlID="hiddenTargetControlForModalPopup"
PopupControlID="programmaticPopup"
BackgroundCssClass="modalBackground"
DropShadow="True"
PopupDragHandleControlID="programmaticPopupDragHandle"
RepositionMode="RepositionOnWindowScroll" >
</ajaxToolkit:ModalPopupExtender>
<asp:Panel runat="server" CssClass="modalPopup" ID="programmaticPopup" style="display:none;width:350px;padding:10px">
<asp:Panel runat="Server" ID="programmaticPopupDragHandle" Style="cursor: move;background-color:#DDDDDD;border:solid 1px Gray;color:Black;text-align:center;">
ModalPopup shown and hidden in code
</asp:Panel>
You can now use this sample to see how to use ModalPopup with an invisible TargetControl. The ModalPopupExtender
this popup is attached to has a hidden target control. The popup is hidden
<asp:LinkButton runat="server" ID="hideModalPopupViaServer" Text="on the server side in code behind" OnClick="hideModalPopupViaServer_Click" /> and
<a id="hideModalPopupViaClientButton" href="#">on the client in script</a>.
<br />
</asp:Panel>
///And in the Code behind it is like this
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
programmaticModalPopup.Show();
DBActivityDelegate d = new DBActivityDelegate (DBACtivityMethod);
d.BeginInvoke(new AsyncCallback(HidModalPopup))
}
public void HidModalPopup(IAsyncResult R )
{
programmaticModalPopup.Hide();
}
>>> cant get this to work even after 4/5 hours of effort..
This doesn't help us.
What exact problem do you have? The popup doesn't show up? You have error message? Please elaborate your problem.
This doesn't help us.
What exact problem do you have? The popup doesn't show up? You have error message? Please elaborate your problem.
ASKER
Doest show up...
Any code snippets will help
if you could also explain what these attribute mean and do as well
BehaviorID
TargetControlID
Any code snippets will help
if you could also explain what these attribute mean and do as well
BehaviorID
TargetControlID
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Is it ok to use Checkbox instead of Button (which is not appropriate in my case) for TargetControlID
My question is, whether the modal popup accept any control as the target control
thanks
My question is, whether the modal popup accept any control as the target control
thanks
1. Ater you change the TargetControlID to the CheckBox, does the popup show up?
2. My understanding is not every control can be assigned to TargetControlID. The control has to be able to fire click event. For example, I don't think the Label control can be assigned to TargetControlID. Correct me if I am wrong.
2. My understanding is not every control can be assigned to TargetControlID. The control has to be able to fire click event. For example, I don't think the Label control can be assigned to TargetControlID. Correct me if I am wrong.