2012-08-14 45 views
1

我在我的Webapplication.I中使用了Ajax ControlToolkit中的ModalPopupExtender,將其設置爲Drag屬性爲true,但是當我拖動彈出面板並將其放在新位置時,它會返回原始位置我想要獲得像樣品一樣的效果,可以在不同的位置拖放。如何在頁面上的例子..如何使ModalPopup拖放

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:我想在文本框輸入的背景,如果對話框打開。

更新:

...

<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> 

...

+0

哪裏是'PopupHeader'? 'PopupHeader'必須是通過拖放操作完成的某個div或面板。 – yogi 2012-08-14 07:36:17

+0

我是怎麼做到的?我新與這個控制:(我需要幫助或一個很好的鏈接 – Tarasov 2012-08-14 07:57:57

+0

看到我的更新...是嗎? – Tarasov 2012-08-14 08:06:42

回答

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> 
+0

是的,它的工作.... :) – Tarasov 2012-08-14 08:48:57