Showing posts with label object. Show all posts
Showing posts with label object. Show all posts

Saturday, March 24, 2012

ModalDialog inside updatepanel

I've got a button that shows a modal dialog box. The idea is to add an object to a database, then refresh a listbox on the main page. The dialog works correctly, except with click cmdOk, the server side function is never called. I suspect it's because there's no longer an event handler registered by JS that calls the script to do the postback. I probably need to create a client side script using OnOkScript="onOK()", but I have no idea how to make the page postback to call cmdNewObject_Click without a full postback. Any ideas?

Thanks,

Rick

<asp:LinkButtonID="cmdAddObject"runat="server"Text="Add Object"></asp:LinkButton>

<cc1:ModalPopupExtenderID="ModalPopupExtender1"runat="server">

<cc1:ModalPopupPropertiesBackgroundCssClass="modalBackground"OkControlID="cmdOk"CancelControlID="cmdCancel"DropShadow="true"PopupControlID="pnlAddObject"TargetControlID="cmdAddObject"></cc1:ModalPopupProperties>

</cc1:ModalPopupExtender>

<atlas:UpdatePanelID="pnlPopup"runat="server"Mode="conditional">

<Triggers>

<atlas:ControlEventTriggerControlID="cmdOk"EventName="Click"/>

</Triggers>

<ContentTemplate>

<asp:PanelID="pnlAddObject"runat="server"CssClass="modalPopup"Style="display: none">

<div>

<divid="ObjectName">

<asp:TextBoxID="txtObjectName"runat="server"></asp:TextBox></div>

<div>

<divid="OkButton">

<asp:ButtonID="cmdOk"runat="server"OnClick="cmdNewObject_Click"Text="New Object"/></div>

<divid="CancelButton">

<asp:ButtonID="cmdCancel"runat="server"Text="Cancel"/></div>

</div>

</div>

</asp:Panel>

</ContentTemplate>

</atlas:UpdatePanel>

Seethis post and maybe consider removing the OkControlID property so the Ok button can postback normally (thereby dismissing the ModalPopup). I'm thinking you may also want to get rid of the UpdatePanel here as I'm not sure it'll ultimately be necessary.

Wednesday, March 21, 2012

ModalPopup + Flash + Firefox = problem?

Hey

I'm trying to include a flash object in my ModalPopup panel but when it the ModalPopup pops up, the flash object can't be accessed using FireFox (2.0.0.2).. Now.. to be clear, the flash object does show however I can't really click on the object... What's strange about this is that I can click on certain parts of the object but not others..

Originally I thought it was an issue relating to z-index so I set the <object> tag to have a z-index of 1000000 (you know.. some thing ridiculous), hoping that it would put the object to the top thus letting me click it.. Sad to say, no luck there.

I've tried this scenario on IE7 and it works perfectly..

Any ideas of fixes??

Thanks in advance!

Hey, I've just upgraded to the new release of the toolkit ie Version 1.0.10301.0 and I still am having the same problem..

Help? Anyone on the Ajax team maybe?

modalPopup _show() and $object(modalPopupExtndr).set_OnOkScript(script()) not working with

Over the last few days I have upgraded to the beta 1 and the latest ajaxControlToolkit...Now my modalPopup no longer works and I have been trying to figure a work around for the last day or so. I am using the code located athttp://www.geekzilla.co.uk/ViewDAAE6AAB-0369-45C2-BE78-B8E6F876B4F4.htm but now that <atlasToolkit:ModalPopupProperties no longer exists I am at ends trying to call the _show() method using the $object('modalPopupExtndr')._show() b/c i get a null error. I will post my exact code if needed, but it is a basic modalPopup...any ideas?


Thanks,
Greg

Quote from the migration guide... (http://blogs.msdn.com/sburke/archive/2006/10/20/atlas-control-toolkit-ajax-control-toolkit-migration-guide.aspx)

The$('...') alias fordocument.getElementById('...') has been changed to$get('...'). The$object('...') alias forSys.Application.findControl('...') has also been changed to$find('...'). See PopupControlBehavior.js:52.

It looks like you should try $find('modalPopupExtndr')._show()

Good Luck.


Referenced here too...

http://ajax.asp.net/ajaxtoolkit/Walkthrough/AtlasToAspNetAjax.aspx


Thanks for the reply but I think the problem is deeper than just changing it from object to find. I didn't change object to find b/c in the AspNet Ajax CTP to Beta Whitepaper doc I quote this from it: "In the CTP release, you could use the $object('GoShopping') construct to reference a component created as a result of xml-script. The Value-add release will continue to support this alias." Since I am using the Value-add I figured I would not need to change ojbect to find. However changing object to find did help solve one of my issues. The above quote can be found at this link:http://ajax.asp.net/files/AspNet_AJAX_CTP_to_Beta_Whitepaper.doc

Here is my code and it is erroring in the ShowMessageBox javaScript function on the $object('MsgBoxExtndrProps')._show(); call and I tried using find but that didnt work either. notice though that $object('MsgBoxExtndrProps')._hide(); works fine when I want to close the modalPopup...any ideas??:

<div id="MsgBoxDialog" class="MessageBox" style='display: none;'>
<div id="MsgBoxDialogHeader" class="PopupDialogHeader">
<img id="MsgBoxDialogCloser" class="PopupDialogCloser" alt="Close" onclick="$object('MsgBoxExtndrProps')._hide();"
src="http://pics.10026.com/?src=../Images/Closer.jpg" />
<span id="MsgBoxDialogTitle" class="PopupDialogTitle"></span>
</div>
<div id="MsgBoxDialogContent" class="MessageBoxContent">
<div id="MsgBoxQuestion" class="MessageBoxQuestion">
</div>
<div id="msgBoxButtons" class="MessageBoxButtons">
<input id="btnConfirm" type="button" value="Yes" />
<input id="btnNoConfirm" type="button" value="Cancel" />
</div>
</div>
</div>
<div style='display: none; visibility: hidden;'>
<asp:Button runat="server" ID="btnHidden" />
</div>
<ajaxToolkit:ModalPopupExtender
ID="MsgBoxExtndr" runat="server"
TargetControlID="btnHidden" PopupControlID="MsgBoxDialog"
BackgroundCssClass="modalBackground" DropShadow="true"
OkControlID="btnConfirm" OnOkScript="onOk()"
CancelControlID="btnNoConfirm" BehaviorID="MsgBoxExtndrProps">
</ajaxToolkit:ModalPopupExtender>

<script type="text/javascript">

var msgBoxQuestion; // content of the tskDlgDiv
var msgBoxTitle; // Title of the task dialog

InitMsgBox();

function InitMsgBox()
{
msgBoxQuestion = new Sys.Preview.UI.Label($get("MsgBoxQuestion"));
msgBoxQuestion.initialize();

msgBoxTitle = new Sys.Preview.UI.Label($get("MsgBoxDialogTitle"));
msgBoxTitle.initialize();
}

/*
When the user is about to make a significant change
this is used as a confirmation...if they answer yes, then
the command param is executed.
*/
function ShowMessageBox(title, question, command)
{
msgBoxTitle.set_text(title); // set the title of the messageBox
msgBoxQuestion.set_text(question); // Ask the question to the user
$find('MsgBoxExtndrProps').set_OnOkScript(command); // If they answer yes, execute this command
$object('MsgBoxExtndrProps')._show(); // try find or object and it does not work...however $object('MsgBoxExtndrProps')._hide(); works fine??
}
function onOk() { return true; }
</script>


Try this...

I changed this line...

$object('MsgBoxExtndrProps')._show();

to...

var popUp = $find('MsgBoxExtndrProps');
popUp.show();

and it popped the window.


Bravo Todd...It worked like a champ.

I just made it $find('MsgBoxExtndrProps').show(); and it worked without creating the extra var. It is strange how the _hide() works but the _show() doesn't...strange.