Hello Gabor,
Since each ASPxPopupControl is nested in an UpdatePanel, it is completely replaced every time you click the "Postback" button. Being showed the ASPxPopupControl changes something (for instance, it hides the scrollbars). To restore the previous state, it's necessary to close the ASPxPopupControl before the update. Otherwise, the UpdatePanel will remove the old ASPxPopupControl and then will insert a new one. The new ASPxPopupControl will knows nothing about its predecessor and its requirements (for instance, it might need to restore the scrollbars or something else).
Here are some code snippets, illustrating how you to close an ASPxPopupControl before updating:
[ASPx]... Dummy text <script type="text/javascript"> function SetIsShowRequired(value) { var hf = document.getElementById("ShowRequired"); hf.value = value.toString(); } function OnClick() { SetIsShowRequired(true); myPopup.Hide(); __doPostBack(); } </script> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:HiddenField ID="ShowRequired" runat="server" Value="false"/> <dxpc:ASPxPopupControl ID="ASPxPopupControl1" runat="server" ClientInstanceName="myPopup" CloseAction="CloseButton" Modal="True" EnableClientSideAPI="True"> <ContentCollection> <dxpc:PopupControlContentControl runat="server"> <button type="button" value="Close&postback" onclick="OnClick()"></button> </dxpc:PopupControlContentControl> </ContentCollection> </dxpc:ASPxPopupControl> </ContentTemplate> </asp:UpdatePanel> <asp:Button ID="Button2" runat="server" Text="Show Dialog" OnClientClick="myPopup.Show(); return false;" /> ...
[C#]public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (bool.Parse(ShowRequired.Value)) ASPxPopupControl1.ShowOnPageLoad=true; ShowRequired.Value = "false"; } }
We understand that this solution is not the best, and we're planning to improve this behavior in future. In particular, we've got a suggestion for this: ASPxPopupControl - Provide the capability for a visible client popup control object to work correctly when it doesn't have the information about its corresponding HTML markup.
If the aforementioned solution doesn't meet your requirements, we can suggest a simpler approach. If you put the UpdatePanel into an ASPxPopupControl everything will fork fine. In case you will want to close the ASPxPopupControl from your server-side code, we've added a new button - "Postback and close". Here are the sample snippets:
[ASPx]... <dxpc:ASPxPopupControl ID="ASPxPopupControl1" runat="server" ClientInstanceName="myPopup" CloseAction="CloseButton" Modal="True" EnableClientSideAPI="True"> <ContentCollection> <dxpc:PopupControlContentControl runat="server"> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Button ID="Button1" runat="server" Text="Postback" /> <asp:Button ID="Button3" runat="server" Text="Postback and close" onclick="Button3_Click" /> </ContentTemplate> </asp:UpdatePanel> </dxpc:PopupControlContentControl> </ContentCollection> </dxpc:ASPxPopupControl> ...
[C#]... public partial class _Default2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button3_Click(object sender, EventArgs e) { ScriptManager.RegisterStartupScript(this, this.GetType(), "ClosingScript", "myPopup.Hide()", true); } }
In any case, we recommend that you use the first solution if you have to change only some ASPxPopupControl's server-side properties (for instance, if you have to change its behavior via an UpdatePanel's postback). The second solution is more useful in other cases.
>>
D: if I move the dialog outside of the visible area (e.g to the rigth), then a scrollbar is added. I think this is a problem. The best would be to let the user navigate ONLY in the current page area, and do NOT let him to extend this area.
<<
This is actually a common behavior of web browsers. Could you please explain the problem in greater detail? Since you allow dragging for your ASPxPopupControl, an end-user can drag it beyond the browser's visible window (for instance, if he/she wants to see the content hovered by the ASPxPopupControl). As far as you allow the scrollbar's visibility, the end-user can use either dragging or scrolling to access the ASPxControl. So, we treat this as a designed behavior.
Thanks,
Serge
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.
Facebook
Twitter
Google+