2013-07-06 70 views
1
<asp:Button ID="btnCheckPatientID" CssClass="cssbutton" runat="server" Text="Check" 
        OnClick="btnCheckPatientID_Click" /> 
       <asp:ModalPopupExtender ID="btnCheckPatientID_ModalPopupExtender" runat="server" 
        PopupControlID="panelCheckPatient" TargetControlID="hiddenTargetControlForModalPopup" 
        BackgroundCssClass="modalbackground" CancelControlID="btnClose"> 
       </asp:ModalPopupExtender> 

<asp:Button runat="server" ID="hiddenTargetControlForModalPopup" Style="display: none" /> 

<div id="panelCheckPatient" class="modalpopup" style="display: none"> 
     <iframe id="iframeCheckPatient" class="csstable" runat="server" width="550px" height="485px" scrolling="auto"> 
     </iframe> 
     <table> 
      <tr> 
       <td align="right"> 
        <asp:Button ID="btnClose" runat="server" CssClass="cssbutton" Text="Close" /> 
       </td> 
      </tr> 
     </table> 
    </div> 

即成代碼返回值父頁面

protected void btnCheckPatientID_Click(object sender, EventArgs e) 
    { 
     iframeCheckPatient.Attributes["src"] = "Check_Patient.aspx?patientID=" + txtPatientID.Text.Trim(); 
     btnCheckPatientID_ModalPopupExtender.Show(); 
    } 

我有btnCheckPatientID的點擊開一個Ajax模式彈出。 在Modal Popup中加載一個包含Check_Patient.aspx頁面的iframe。所有工作都正常。

在Check_Patient.aspx中有Pass按鈕。 點擊按鈕,我必須返回一些值到父頁面。

我該怎麼做。 搜索在谷歌,但找不到任何幫助

+0

您可以在子頁面上設置會話並獲取父頁面的值。 –

+0

您好sain pradeep同意在會話中存儲值..如何關閉在iframe頁面(Check_Patient.aspx)中雙擊javascript中的模式彈出框 – John

+0

請參閱此鏈接:-http://stackoverflow.com/questions/3876986/hide-modalpopup-from-iframe –

回答

0

,你需要指定父頁面地址,父頁面上使用下面的代碼可以使用按鈕PostBackUrl屬性:

比方說您有一個文本框您彈出窗口,你可以使用相同folows

TextBox txtnew=(TextBox)PreviousPage.FindControl("id or name of control"); 

,然後用它的價值,或者創建彈出頁面上的屬性一樣

public string popupdata 
{ 
    get; set; 
} 
popupdata=your poppage value; 

現在訪問相同的使用

string str=PreviousPage.popupData.Tostring(); 

父頁面上或者您可以使用Cookie或會話的其他選項。

+0

謝謝極客如何關閉在iframe頁面(Check_Patient.aspx)中雙擊javascript中的模態彈出框 – John

+0

在clientClick上點擊按鈕,您可以在客戶端調用close方法(使用javascript )關閉你的彈出窗口。 – Geek