简体   繁体   English

从模式弹出扩展器返回值到父页面

[英]return value to parent page from modal pop up extender

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

Serve Code 服务代码

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

I have open an Ajax Modal popup on click of btnCheckPatientID. 单击btnCheckPatientID时,我打开了一个Ajax Modal弹出窗口。 In Modal Popup load an iframe which contains Check_Patient.aspx page.All working correctly. 在模式弹出窗口中加载包含Check_Patient.aspx页面的iframe。

In Check_Patient.aspx there is Pass button. 在Check_Patient.aspx中,有“通过”按钮。 On click of button i have to return some value to parent page. 在单击按钮时,我必须将一些值返回到父页面。

What should i do. 我该怎么办。 Search on google but cant find any help 在Google上搜索,但找不到任何帮助

You can use button postbackurl property where you need to specify your parent page address and on the parent page use the following code: 您可以在需要指定父页面地址的地方使用按钮postbackurl属性,并在父页面上使用以下代码:

let say you have a textbox on your popup, you can use the same as folows 假设您在弹出窗口上有一个文本框,您可以使用以下对话框

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

and then use its value OR create a property on popup page like 然后使用其值,或在弹出页面上创建一个属性,例如

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

now access the same on parent page using 现在使用

string str=PreviousPage.popupData.Tostring();

OR you can use cookies or session as your other options. 或者,您可以使用Cookie或会话作为其他选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM