如何使ModalPopup拖放

时间:2012-08-14 07:31:50

标签: c# asp.net ajax modal-dialog modalpopupextender

我在我的Webapplication中使用Ajax ControlToolkit中的ModalPopupExtender。我设置它的Drag属性为true,但是当我拖动弹出面板并将其放在新位置时,它立即返回原始位置。我想要获得像Sample一样的效果,可以在不同的位置拖放。如何在页面上的示例..

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/ModalPopup/ModalPopup.aspx

我的代码:

<form id="form1" runat="server">

    <asp:scriptmanager id="ScriptManager1" runat="server">
       </asp:scriptmanager> 

       <asp:button id="btnAddNew" runat="server" text="New Expanse" />

       <asp:modalpopupextender id="ModalPopupExtender1" 
                runat="server" cancelcontrolid="btnCancel" 
                okcontrolid="btnOkay" targetcontrolid="btnAddNew" 
                popupcontrolid="Panel1" popupdraghandlecontrolid="PopupHeader" 
                drag="true" backgroundcssclass="ModalPopupBG">
      </asp:modalpopupextender>

<div class="popupConfirmation" id="Panel1" style="display: none">

        <iframe id="frameeditexpanse" src="Benutzer.aspx" frameborder="1" height="500px" width="520px">
        </iframe>

        <div class="popup_Buttons" style="display: none">
            <input id="btnOkay" type="button" value="Speichern" />
            <input id="btnCancel" type="button" value="Abbrechen" />
        </div>

</div>

PS:如果Dialog打开,我想在后台的TextBoxes中输入。

更新

...

<asp:modalpopupextender id="ModalPopupExtender1" 
                runat="server" cancelcontrolid="btnCancel" 
                okcontrolid="btnOkay" targetcontrolid="btnAddNew" 
                popupcontrolid="Panel1" popupdraghandlecontrolid="PopupHeader" 
                drag="true" backgroundcssclass="ModalPopupBG">
      </asp:modalpopupextender>


   <div id="PopupHeader" style="display: none; background-color:Blue">
        Benutzerinformationen
   </div>

   <div class="popupConfirmation" id="Panel1" style="display: none">

    <iframe id="frameeditexpanse" src="ZweiteSeite.aspx" frameborder="1">
    </iframe>

    <div class="popup_Buttons" style="display: none">
        <input id="btnOkay" type="button" value="Speichern" />
        <input id="btnCancel" type="button" value="Abbrechen" />
    </div>

...

2 个答案:

答案 0 :(得分:5)

试试这个

<style type="text/css">
  .modalPopup
  {
    background-color: #ffffdd;
    border-width: 3px;
    border-style: solid;
    border-color: Gray;
    padding: 3px;
    width: 100%;
  }
</style>

<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:Button ID="btnAddNew" runat="server" Text="New Expanse" />
    <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" CancelControlID="btnCancel"
        OkControlID="btnOkay" TargetControlID="btnAddNew" PopupControlID="Panel1" PopupDragHandleControlID="PopupHeader"
        Drag="true" BackgroundCssClass="ModalPopupBG">
    </cc1:ModalPopupExtender>
    <div class="popupConfirmation" id="Panel1" style="display: none">
        <asp:Panel runat="server" ID="PopupHeader" CssClass="modalPopup">
            **************** Drag me ****************
        </asp:Panel>
        <iframe id="frameeditexpanse" src="http://www.bing.com" frameborder="1" height="500px"
            width="520px"></iframe>
        <div class="popup_Buttons" style="display: none">
            <input id="btnOkay" type="button" value="Speichern" />
            <input id="btnCancel" type="button" value="Abbrechen" />
        </div>
</div>

答案 1 :(得分:0)

@yogi发布的答案非常有效。如果出现问题,请尝试在其他浏览器中浏览同一页面,因为它在Edge和Chrome中可以正常运行,但是Internet Explorer在移动弹出窗口和拖放操作方面存在问题。