ND's
ND's

Reputation: 2225

Pass query string to Modal Pop Up

This is how my modal popup looks like

  <asp:TextBox ID="txtPatientID" AutoCompleteType="Disabled" runat="server" CssClass="csstextbox" Width="350px"></asp:TextBox>      

             <asp:Button ID="btnCheckPatientID" CssClass="cssbutton" runat="server" Text="Check" />
                                    <asp:ModalPopupExtender ID="btnCheckPatientID_ModalPopupExtender" runat="server"
                                        PopupControlID="panelCheckPatient" TargetControlID="btnCheckPatientID" BackgroundCssClass="modalbackground">
                                    </asp:ModalPopupExtender>            

            <div class="modalpopup" id="panelCheckPatient" style="display: none">
                                <iframe id="iframeCheckPatient" runat="server" width="485px" src="Check_Patient.aspx"
                                    height="485px" scrolling="auto"></iframe>

                            </div>

On Click of btnCheckPatientID I have to pass txtPatientID.Text pass as querystring to Modalpopup (In modalpopup load an iframe) how do i do that?

Upvotes: 0

Views: 2059

Answers (1)

Abhitalks
Abhitalks

Reputation: 28437

You can do so using jQuery:

$('#btnCheckPatientID').live("click", function() {
    // your existing page
    var url = "Check_Patient.aspx";
    // append value of textbox as querystring
    var newUrl = url + "?id=" + $('#txtPatientID').val();
    // update the src attribute of your iframe with the newUrl
    $('#iframeCheckPatient').attr("src", newUrl);
});

Binding "click" event of the button using "live" so that it survives changes. Set the "src" attribute of your iframe to new url by appending the value of textbox as a querystring.

Upvotes: 1

Related Questions