1

我有一个带有超链接的 GridView,在超链接上单击一个 Modal Popup Extender 弹出。根据单击 GridView 上的哪一行来显示或隐藏文本框。我的问题是当 Modal Popup Fires 和用户填写 texboxes 并说他们单击关闭时,当他们单击不同的 GridView 行或与先前数据出现的相同行时,我隐藏了 Modal Popup Extender。似乎模态弹出窗口扩展器没有清除它下面的控件。我尝试将我的 UpdatePanel 设置为有条件的并强制更新不起作用。请帮助我几天来一直试图解决这个问题,它变得非常烦人。谢谢你的帮助。

<asp:UpdatePanel ID="upGrid" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div>     
            <asp:GridView 
                    ID="gvReports" 
                    runat="server" 
                    CssClass="gridview" 
                    RowStyle-CssClass="gridview_itm" 
                    AlternatingRowStyle-CssClass="gridview_aitm" 
                    HeaderStyle-CssClass="gridview_hdr" 
                    PagerStyle-CssClass="gridview_pgr" 
                    AutoGenerateColumns="False" 
                    Width="100%" onrowcommand="gvReports_RowCommand">                
                    <Columns>
                    <asp:TemplateField HeaderText="Name">                    
                        <ItemTemplate>                        
                            <asp:LinkButton ID="btnReport" runat="server" CommandName="Report" CommandArgument='<%#Eval("n_ReportFileName")%>' Text='<%#Eval("n_Name")%>' CausesValidation="false"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Description">                    
                        <ItemTemplate>                        
                            <%#Eval("n_Description")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    </Columns>
            </asp:GridView> 
            <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="Button1" PopupControlID="ReportParameterPanel" BackgroundCssClass="modalBackground" DropShadow="True" />                
            <asp:Button ID="Button1" runat="server" Text="Button" style="visibility:hidden"/>
            <asp:Panel ID="ReportParameterPanel" runat="server" Height="375px"                     
                Width="700px" BackColor="#f4de90" 
                HorizontalAlign="Center" BorderColor="#666666" BorderStyle="Outset" 
                BorderWidth="5px"> 
                <table style="height: 50px; width: 685px; text-align: left">
                    <span id="lblReportName" runat="server" style="font-weight:bold; font-size:larger"></span>
                    <tr>
                        <td align="left" style="padding-left: 5px; width: 335px;" valign="top">
                            <span id="StarDateStar" runat="server" style="color: Red">*Optional&nbsp;</span><span id="lblStartDate" runat="server">Start Date: </span>
                            <asp:TextBox ID="tbStartDate" runat="server"></asp:TextBox>
                            <asp:ImageButton ID="imgCalendar" runat="server" ImageUrl="~/App_Themes/Sugar2006/images/Calendar_scheduleHS.png" ImageAlign="Middle" />
                            <asp:CalendarExtender ID="ceStartDate" runat="server" TargetControlID ="tbStartDate" PopupButtonID="imgCalendar" />        
                            <asp:MaskedEditExtender ID="mexStartDate" runat="server" 
                                TargetControlID="tbStartDate" 
                                Mask="99/99/9999" 
                                MaskType="Date"
                                MessageValidatorTip="true"
                                OnFocusCssClass="MaskedEditFocus"
                                OnInvalidCssClass="MaskedEditError" />
                                <br />
                            <asp:MaskedEditValidator ID="mevStartDate" runat="server" 
                                ControlToValidate="tbStartDate"
                                ControlExtender="mexStartDate" 
                                Display="Dynamic" 
                                InvalidValueMessage="This date is invalid!" Font-Bold="True" 
                                ForeColor="#D50000" ValidationGroup="vgMyGroup" />
                        </td>
                        <td align="left" style="padding-right: 5px; padding-bottom: 5px; width: 350px;" valign="top">
                            <span id="EndDateStar" runat="server" style="color: Red">*Optional&nbsp;</span><span id="lblEndDate" runat="server">End Date: </span>
                            <asp:TextBox ID="tbEndDate" runat="server"></asp:TextBox>
                            <asp:ImageButton ID="imgCalendar2" runat="server" ImageUrl="~/App_Themes/Sugar2006/images/Calendar_scheduleHS.png" ImageAlign="Middle" />
                            <asp:CalendarExtender ID="ceEndDate" runat="server" TargetControlID ="tbEndDate" PopupButtonID="imgCalendar2" />        
                            <asp:MaskedEditExtender ID="mexEndDate" runat="server" 
                                TargetControlID="tbEndDate" 
                                Mask="99/99/9999" 
                                MaskType="Date"
                                MessageValidatorTip="true"
                                OnFocusCssClass="MaskedEditFocus"
                                OnInvalidCssClass="MaskedEditError" />
                                <br />
                            <asp:MaskedEditValidator ID="mevEndDate" runat="server" 
                                ControlToValidate="tbEndDate"
                                ControlExtender="mexEndDate" 
                                Display="Dynamic" 
                                InvalidValueMessage="This date is invalid!" Font-Bold="True" 
                                ForeColor="#D50000"
                                ValidationGroup="vgMyGroup" />
                        </td>
                    </tr>
                </table>                                                                  
                <asp:Button ID="btnClose" runat="server" Text="Close" CssClass="btn" onclick="btnClose_Click" CausesValidation="false" />
                <asp:Button ID="btnSend" runat="server" Text="Report" CssClass="btn" OnClick="btnSend_Click" Enabled="false" CausesValidation="true" ValidationGroup="vgMyGroup" />                    
            </asp:Panel>
                </div>
</ContentTemplate>
<Triggers>
    <asp:PostBackTrigger ControlID="btnSend" />
</Triggers>
</asp:UpdatePanel> 
4

2 回答 2

0

改用 LinkBut​​tons 并单击清除 modalpopup 中的控件,然后调用 ModalPopup.Show()

于 2012-04-10T14:19:38.837 回答
0

尝试从代码隐藏调用 modalpopupextender:

ModalPopupExtender1.Show();
于 2012-04-10T14:13:14.623 回答