Showing posts with label save. Show all posts
Showing posts with label save. Show all posts

Wednesday, March 28, 2012

Modal popup and postback

Hello,
I'm using a modal popup which contains a OkButton which should normally do a postback to save the option value.
But the postback is not done, either in a regular form (not in an update panel) nor an atlas form, simply nothing is done.
Is it a way to do that? The description of the control says just to do postback like normal ones.
You can see this bug here:http://www.wdagent.com, clic on the messaging on the right menu the on "options" (you can see that the page is not reloaded and the updateprogress loading is not shown).

The code is the following :
[code}
<act:ModalPopupExtender ID="OptionsPopUpMaker" runat="server">
<act:ModalPopupProperties TargetControlID="OptionsButton" PopupControlID="Options" BackgroundCssClass="modalBackground" DropShadow="false" OkControlID="ValidateOptionsButton" CancelControlID="CancelOptionsButton" />
</act:ModalPopupExtender>

<div style="display: none;">
<asp:Panel ID="Options" runat="server" Height="80px" Width="300px" CssClass="modalPopup">
<asp:RadioButton ID="OptionsFriendsBig" runat="server" GroupName="Options" Text="Afficher les contacts détaillés" /><br />
<asp:RadioButton ID="OptionsFriendsSmall" runat="server" GroupName="Options" Text="Afficher les contacts simples" /><br /><br />
<div style="text-align: right;"><asp:Button ID="ValidateOptionsButton" runat="server" Text="Save preferences" OnClick="SetFriendsOptions" /><asp:Button ID="CancelOptionsButton" runat="server" Text="Cancel" /></div>
</asp:Panel>
</div
I noticed a huge number of bugs in this toolkit (i wasn't even able to use a control bug free!) like :
- The title of the page disapear when clicking on expand/collapse link of a collapsible panel (i rewrited the javascript for this) and disable the partial rendering of the page.
- The textboxwatermark disable the partial rendering of the page (i don't know how it is possible but it is...).

Thanks for your helpSorryn the "options" is in the "friends" tab
chech this out, it could give you an idea or a way to solve it..
what you really could do is:
do a javascript call like:
__doPostBack('ValidateOptionsButton', '');
on the save button

but you will notice that your controls (OptionsFriendsSmall)will not hold the values for the postback
so you will have to assign them o another hidden control before the postback

so to test the postback your modalpopupextender property onOkScript will look like:

OnOkScript="__doPostBack('ValidateOptionsButton', '')"

if this works but doenst post back the values of theOptionsFriendsSmall create a hidden field and ajava script function that saves the value to the hidden field first and then does the postsback call.

for example:
OnOkScript="savevalue(seletedvalue)"

and inside thesavevalue function do the__doPostBack



Please also have a look at the following threads for ModalPopup background/fixes:http://forums.asp.net/thread/1277351.aspx,http://forums.asp.net/thread/1287520.aspx.


thanks :)

Monday, March 26, 2012

Modal popup extender postback issue

Hai

I'm using Ajax toolkit modal popup extender to open the popup window, In that window having two buttons, save button save the entered information into database and cancel button close the popup window.When click the save button changes are saved and window remain open, this is my requirement. But when i clicked that save button the informations are saved and popup window is closed.

How i will get my requirement ? Plz help anyone.

kamal...

use Show method of the control object to make it visible


Hi Kama19101980,

If you want to show a window when storing data to database and hide the window as soon as the process finished, I think you should better useUpdatePanel + UpdateProgress. Otherwise(keep the window open after storing the data), we shall use UpdatePanel + ModalPopupExtender.

Now you can put all the inputs inside an UpdatePanel and the Button is set to be the trigger of the UpdatePanel or just inside the UpdatePanel.For example,

<UpdatePanel>controls <Button></UpdatePanel>

When the partial update occurs, we show the ModalPopupExtender. You can do it like this,

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);

function BeginRequestHandler(sender, args){
$find("ModalPopupExtender's BehaviorID").show();
}

I hope this help.

Best regards,

Jonathan