从ModalPopUpExtender更新UpdatePanel

时间:2014-09-16 06:27:55

标签: asp.net updatepanel modalpopupextender

当modalpopupextender调用updatepanel时,我无法更新更新面板。它是一个小的搜索弹出窗口,它有患者姓名部分和历史部分两部分。 popupextender由图像按钮和OnClick代码隐藏:

触发
protected void imgSearchPrincipal_Click(object sender, ImageClickEventArgs e)
        {
            tblMedHistory.Visible = false; 
            upMedHistory.Update();
            pnlMedSrchPrincipal_Ext.Show();
        }

以下是弹出窗口的脚本:

<div runat="server" id="divMedSearch" class="cls_gen_style">
        <asp:Panel runat="server" ID="pnlMedSearch" >
            <table runat="server" class="tables_gen tblPop"><tr><td>

                <table style="border-spacing:0px">
                    <tr><td style="height:10px"></td></tr>
                    <tr><td colspan="6" class="tp_dotline"></td></tr>
                    <tr>
                        <td colspan="4" class="rw_header">SEARCH</td>
                        <td colspan="2" style="background-color:navy; text-align:center"><asp:LinkButton runat="server" ID="lbClose" Style="color:white" Text="CLOSE" OnClick="lbClose_Click"></asp:LinkButton> </td>
                    </tr>
                    <tr><td colspan="6" class="bt_dotline"></td></tr>
                    <tr><td style="height:7px"></td></tr>

                    <tr>
                        <td style="width:3px"></td>
                        <td>PATIENT NAME</td>
                        <td><input type="text" runat="server" id="txt_srch_patient" /></td>
                        <td></td>
                        <%--<td><input type="button" runat="server" id="btnSearch" class="btn btn-info btns_text" value="SEARCH" /></td>--%>
                        <td><asp:Button runat="server" ID="btnSearch" CssClass="btn btn-info btns_text" Text="SEARCH" OnClick="btnSearch_Click"/></td>
                        <td style="width:5px"></td>
                    </tr>
                    <tr>
                        <td colspan="2"></td>
                        <td>
                        <table style="font-size:8px">
                            <tr>
                                <td>SEARCH IN:</td>
                                <td style="width:3px"></td>
                                <td><asp:RadioButton runat="server" ID="rdoLastname" /> </td>
                                <td>LAST NAME</td>
                                <td><asp:RadioButton runat="server" ID="rdoFullname" /></td>
                                <td>FULL NAME</td>
                            </tr>
                        </table>
                    </td></tr>
                    <tr><td colspan="6" class="tp_dotline"></td></tr>

                    <tr><td style="height:5px"></td></tr>
                    <tr>
                        <td></td>
                        <td colspan="4">
                            <asp:GridView runat="server" ID="gvClientNames"
                                RowStyle-Wrap ="false"
                                ShowHeader="true"
                                HeaderStyle-Height="30px"
                                Font-Names="Arial,Sans-Serif"
                                CellPadding="4"
                                ForeColor="#333333"
                                GridLines="None"
                                RowHeaderColumn="1" 
                                Width="100%"

                                BackColor="White" 
                                Font-Size="10px"
                                AlternatingRowStyle-BackColor="AliceBlue"

                                AutoGenerateColumns="False" 
                                ShowHeaderWhenEmpty="True" 
                                HeaderStyle-BackColor="#507CD1"
                                HeaderStyle-ForeColor="White">

                                <Columns>
                                    <%--<asp:BoundField DataField="claim_no" HeaderText="CLAIM NO" />--%>
                                    <asp:BoundField DataField="policy_no" HeaderText="POLICY NO" />
                                    <asp:BoundField DataField="name" HeaderText="NAME" HeaderStyle-HorizontalAlign="Left" />
                                </Columns>

                            </asp:GridView>
                        </td>
                        <td></td>
                    </tr>
                    <tr><td style="height:5px"></td></tr>
                    <tr><td colspan="6" class="tp_dotline"></td></tr>
                    <tr><td colspan="5" style="text-align:right"><input type="button" runat="server" id="btnSelName" class="btn btn-info btns_text" value="SELECT NAME" /> </td></tr>
                </table>

                <div runat="server" id="divMedHistory">
                    <asp:UpdatePanel runat="server" ID="upMedHistory"><ContentTemplate>
                    <table runat="server" id="tblMedHistory" style="width:100%">
                        <tr><td colspan="6" class="bt_dotline"></td></tr>
                        <tr>
                            <td></td>
                            <td colspan="2">MEDICAL HISTORY</td>
                        </tr>
                        <tr><td style="height:3px"></td></tr>
                        <tr>
                            <td></td>
                            <td colspan="4">
                                 <asp:GridView runat="server" ID="gvMedHistory"
                                    RowStyle-Wrap ="false"
                                    ShowHeader="true"
                                    HeaderStyle-Height="30px"
                                    Font-Names="Arial,Sans-Serif"
                                    CellPadding="4"
                                    ForeColor="#333333"
                                    GridLines="None"
                                    RowHeaderColumn="1" 
                                    Width="100%"

                                    BackColor="White" 
                                    Font-Size="10px"
                                    AlternatingRowStyle-BackColor="AliceBlue"

                                    AutoGenerateColumns="False" 
                                    ShowHeaderWhenEmpty="True" 
                                    HeaderStyle-BackColor="#507CD1"
                                    HeaderStyle-ForeColor="White">

                                    <Columns>
                                        <asp:BoundField DataField="claim_no" HeaderText="CLAIM NO" />
                                        <asp:BoundField DataField="policy_no" HeaderText="POLICY NO" />
                                        <asp:BoundField DataField="diagnosis" HeaderText="DIAGNOSIS" />
                                        <asp:BoundField DataField="date" HeaderText="DATE" />
                                    </Columns>

                                </asp:GridView>
                            </td>
                        </tr>

                        <tr><td style="height:5px"></td></tr>
                        <tr><td colspan="5" class="tp_dotline"></td></tr>
                        <tr><td colspan="5" style="text-align:right"><input type="button" runat="server" id="btnOpenClaim" class="btn btn-info btns_text" value="OPEN CLAIM" /> </td></tr>

                        <tr><td style="height:10px"></td></tr>
                    </table>
                    </ContentTemplate>
                    <%--<Triggers>
                        <asp:AsyncPostBackTrigger ControlID="imgSearchPrincipal" />
                    </Triggers>--%>
                    </asp:UpdatePanel>
                </div>

            </td></tr></table>    

        </asp:Panel>    
        <%--<asp:HiddenField ID="hfClientID" runat="server" />
        <asp:HiddenField ID="hfOtherFeeID" runat="server" />
        <asp:HiddenField ID="hfOtherDocID" runat="server" />

        <%--<ajaxToolkit:ModalPopupExtender ID="pnlPolicyLogin_Ex" runat="server" TargetControlID="pnlPolicyLogin_ModalEx_Ctrl" PopupControlID="pnlPolicyLogin" BackgroundCssClass="modalLogin" Enabled="True" />--%>

        <ajaxToolkit:ModalPopupExtender runat="server" ID="pnlMedSrchPrincipal_Ext" TargetControlID="imgSearchPrincipal" PopupControlID="pnlMedSearch" Enabled="true" ></ajaxToolkit:ModalPopupExtender>
        <ajaxToolkit:ModalPopupExtender runat="server" ID="pnlMedSrchPatient_Ext" TargetControlID="imgSearchPatient" PopupControlID="pnlMedSearch" Enabled="true" ></ajaxToolkit:ModalPopupExtender>

    </div>

此窗口弹出窗口就好了。但问题是当用户点击图像按钮(imgSearchPrincipal)时,我需要隐藏 tblMedHistory 。但是如果用户点击不同的图像按钮,我需要在弹出时显示 tblMedHistory 。当popextender调用div / panel时,我无法隐藏表格。任何解决方法?

谢谢,

1 个答案:

答案 0 :(得分:0)

我想我终于解决了这个问题。我没有将ModalPopUpExtender的TargetControlID指向也触发表可见性的图像按钮,而是将TargetControlID引用到隐藏字段,所以现在imagebutton控制表的可见性以及通过代码隐藏而不使用弹出窗口更新面板