0

我正在开发一个 Asp.net 网站。我Ajax:ModalPopupExtender用于显示一些信息。

html

<asp:UpdatePanel ID="upnlModelPopup" runat="server" UpdateMode="Conditional">
        <ContentTemplate> 

Form control goes here...............

<asp:Button ID="btnShow" runat="server" CssClass="btn" Text="Adjustment" OnClick="btnShow_Click" Enabled="true" />

            <cc1:ModalPopupExtender ID="mpeAdjAmt" runat="server" TargetControlID="lblHead"
                PopupControlID="pnlMsg" BackgroundCssClass="displayHide"
                DropShadow="true" OkControlID="lblStsFoot" OnOkScript="setFocus()" >
            </cc1:ModalPopupExtender>
            <asp:Panel ID="pnlMsg" runat="server" CssClass="ErrorPanel" >
                <table width="100%">
                    <tr>
                        <td >
                            <asp:Label ID="lblHead" CssClass="lblHead" runat="server" 
                                Text=""></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td >
                            <table class="tblTableHead" >
                                <tr >
                                   <td style ="width:4%;">S.No</td>
                                   <td style ="width:21%;">Type</td>
                                   <td style ="width:25%;">Date</td>
                                   <td style ="width:20%;">Amount Type</td>
                                   <td style ="width:15%;">Amount</td>
                                   <td style ="width:15%;">Adjust Amount</td>
                                </tr>
                            </table>
                            <div id="divGridStatus" style="width:100%;max-height:300px;overflow-Y:auto;overflow-X:hidden;" >
                               <asp:GridView ID="grvStatus" runat="server" Width="100%"
                                    AutoGenerateColumns="false" CssClass="GridViewStyle" GridLines="None" ShowHeader="false" >
                                    <Columns>
                                        <asp:TemplateField >
                                           <ItemTemplate>   
                                                <asp:LinkButton ID="lnkSNo" runat="server" CssClass="lbl"
                                                    Width="100%" OnClientClick="return false;" Font-Underline="false"
                                                    ReadOnly="true" >
                                                    <%# ((GridViewRow)Container).RowIndex + 1%>
                                                </asp:LinkButton>
                                           </ItemTemplate>
                                           <ItemStyle Width="4%" />
                                        </asp:TemplateField>                    
                                        <asp:TemplateField >
                                            <ItemTemplate>
                                                <asp:LinkButton ID="lnkwsid" runat="server" Width="100%" OnClientClick="return false;"
                                                    ReadOnly="true" Font-Underline="false"
                                                    Text='<%# Bind("wsid") %>' >
                                                </asp:LinkButton>
                                            </ItemTemplate>
                                            <ItemStyle Width="21%" />
                                        </asp:TemplateField>
                                        <asp:TemplateField >
                                            <ItemTemplate>
                                                <asp:LinkButton ID="lnknm" runat="server" Width="100%" OnClientClick="return false;"
                                                    ReadOnly="true" Font-Underline="false"
                                                    Text='<%# Bind("nm") %>' >
                                                </asp:LinkButton>
                                            </ItemTemplate>
                                            <ItemStyle Width="25%" />
                                        </asp:TemplateField>
                                        <asp:TemplateField >
                                            <ItemTemplate>
                                                <asp:LinkButton ID="lnkgrp1" runat="server" Width="100%" OnClientClick="return false;"
                                                    ReadOnly="true" Font-Underline="false" Text='<%# Bind("grp1") %>' >
                                                </asp:LinkButton>
                                            </ItemTemplate>
                                            <ItemStyle Width="20%" />
                                        </asp:TemplateField>
                                        <asp:TemplateField >
                                            <ItemTemplate>
                                                <asp:LinkButton ID="lnkoptid" runat="Server" CssClass="lbl"
                                                    Width="100%" OnClientClick="return false;" Font-Underline="false"
                                                    ReadOnly="true" Text='<%# Bind("optid") %>' >
                                                </asp:LinkButton>
                                            </ItemTemplate>
                                            <ItemStyle Width="15%" />
                                        </asp:TemplateField>
                                        <asp:TemplateField >
                                            <ItemTemplate>
                                                <asp:LinkButton ID="lnkuid" runat="server"
                                                    Width="100%" CssClass="lbl" OnClientClick="return false;" Font-Underline="false"
                                                    ReadOnly="true" Text='<%# Bind("uid") %>' >
                                                </asp:LinkButton>
                                            </ItemTemplate>
                                            <ItemStyle Width="15%" />
                                        </asp:TemplateField>
                                    </Columns>
                                    <FooterStyle CssClass="FooterStyle" />
                                    <RowStyle CssClass="RowStyle" />
                                    <EmptyDataRowStyle CssClass="EmptyRowStyle" />
                                        <EmptyDataTemplate>
                                            No Data Found.  
                                        </EmptyDataTemplate> 
                                    <PagerStyle CssClass="PagerStyle" />
                                    <SelectedRowStyle CssClass="SelectedRowStyle" />
                                    <HeaderStyle CssClass="HeaderStyle" />
                                    <EditRowStyle CssClass="EditRowStyle" />
                                    <AlternatingRowStyle CssClass="AltRowStyle" />
                                </asp:GridView>
                            </div>
                            <table class="tblTableHead" style="padding-left:1%;">
                                <tr>
                                    <td>
                                        <asp:Label ID="lblStsFoot" runat="server" Text="" ></asp:Label>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <br />
                            <%--OnClientClick="return CheckAdjustment();"OnClientClick="ShowWait();"--%>
                            <asp:Button ID="btnAdjust" runat="server" Text="Done" CssClass="btn" OnClick="btnAdjust_Click" 
                                buttonAction="submitButton" />
                            <asp:Button ID="btnCancel" runat="server" Text="Cancel" CssClass="btn" OnClick="btnCancel_Click" 
                                buttonAction="submitButton" />
                        </td>
                    </tr>
                </table>
            <br />
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>

C# 代码

protected void btnShow_Click(object sender, EventArgs e)
{
    mpeAdjAmt.Show();
    upnlModelPopup.Update();
}
protected void btnAdjust_Click(object sender, EventArgs e)
{
    //Code goes here...
    mpeAdjAmt.Hide();
    upnlModelPopup.Update();
}
protected void btnCancel_Click(object sender, EventArgs e)
{
    mpeAdjAmt.Hide();
    upnlModelPopup.Update();
}

我在后面的代码中显示/隐藏这个面板。当我第一次单击显示按钮时,它工作得很好,它显示面板正确。我的问题是当我第二次单击显示按钮时它不显示面板。如果我删除了更新面板,当我们用于从代码后面显示和隐藏面板时它工作正常,但它在页面加载时开始闪烁面板并且工作正常。

谁能告诉我问题是什么,我该如何解决。

4

1 回答 1

0

尝试做

protected void btnShow_Click(object sender, EventArgs e)
{
mpeAdjAmt.Show();
upnlModelPopup.Update();
mpeAdjAmt.BackgroundCssClass="displayHide";
//or
//pnlMsg.CssClass="ErrorPanel";
}
protected void btnAdjust_Click(object sender, EventArgs e)
{
//Code goes here...
mpeAdjAmt.Hide();
upnlModelPopup.Update();
 mpeAdjAmt.BackgroundCssClass="displayHide";
  //or
 //pnlMsg.CssClass="ErrorPanel";
}
 protected void btnCancel_Click(object sender, EventArgs e)
{
mpeAdjAmt.Hide();
upnlModelPopup.Update();
 mpeAdjAmt.BackgroundCssClass="displayHide";   
 //or
 //pnlMsg.CssClass="ErrorPanel";
}
于 2013-10-30T08:14:18.917 回答