ASP.NET 中的模式弹出窗口

发布于 2024-09-13 17:14:30 字数 11153 浏览 6 评论 0原文

我在这个链接按钮上使用asp.net中的模型弹出窗口,

<asp:LinkButton ID="LinkButton1" runat="server"  CssClass="addProduct-disable" Enabled ="false" Text="Assign Filter Criteria"  CausesValidation="true"                    ></asp:LinkButton>

当我单击弹出窗口中的按钮时,事件被触发,但asp面板和标签没有显示

<table cellpadding="0" cellspacing="0" width="100%">
                <tr>
                    <td colspan="3" class="style3" align="center">
                        Assign Filtering Criteria
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        &nbsp;
                        <asp:Label ID="lblSuccess" runat="server" Text="" ></asp:Label>    

                    </td>
                </tr>
                <tr>
                    <td class="logText" width="30%">
                        Filter:
                        <asp:ImageButton ID="imgFilter" runat="server" ImageUrl="../images/helpIcon.png"
                            border="0" CausesValidation="false" OnClientClick="return showHelp('ctl00_ContentPlaceHolder1_pnlFilterHelp');" />
                        <cc1:ModalPopupExtender ID="mdlFilter" runat="server" TargetControlID="imgFilter"
                            PopupControlID="pnlFilterHelp" DropShadow="false" CancelControlID="lnkFilterCancel"
                            X="410" Y="200" />
                        <asp:Panel ID="pnlFilterHelp" runat="server" Height="70px" Width="170px" Style="display: none;">
                            <asp:Panel ID="pnlFilterOuter" runat="server" CssClass="modalPopup2" Height="100px"
                                Width="180px" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" BackColor="#FFFCF9">
                                <table cellpadding="0" cellspacing="0" width="90%">
                                    <tr>
                                        <td align="center" valign="middle" style="padding-top: 15px; padding-left: 5px;">
                                            <table cellpadding="0" align="center" cellspacing="0" width="100%" height="40px">
                                                <tr>
                                                    <td class="style8">
                                                        Set Filter Criteria so that customer can easily search product.
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding-left: 20px;">
                                            <asp:LinkButton ID="lnkFilterCancel" runat="server" Text="" CssClass="gridPagerlink"
                                                ForeColor="Black">Close <b>X</b></asp:LinkButton>
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                        </asp:Panel>
                    </td>
                    <td width="4px">
                    </td>
                    <td class="logBox">
                        <asp:UpdatePanel ID="filter" runat="server">
                            <ContentTemplate>
                                <asp:DropDownList ID="drpFilter" runat="server" AutoPostBack="True" OnSelectedIndexChanged="drpFilter_SelectedIndexChanged"
                                    Width="150px">
                                </asp:DropDownList>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td class="logText">
                        Filter Option:
                        <asp:ImageButton ID="imgFilterOption" runat="server" ImageUrl="../images/helpIcon.png"
                            border="0" CausesValidation="false" OnClientClick="return showHelp('ctl00_ContentPlaceHolder1_pnlFilterOption');" />
                        <cc1:ModalPopupExtender ID="mdlFilterOption" runat="server" TargetControlID="imgFilterOption"
                            PopupControlID="pnlFilterOption" DropShadow="false" CancelControlID="lnkFilterOptionCancel"
                            X="410" Y="220" />
                        <asp:Panel ID="pnlFilterOption" runat="server" Height="70px" Width="170px" Style="display: none;">
                            <asp:Panel ID="pnlFilterOptionOuter" runat="server" CssClass="modalPopup2" Height="300px"
                                Width="580px" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" BackColor="#FFFCF9">
                                <table cellpadding="0" cellspacing="0" width="90%">
                                    <tr>
                                        <td align="center" valign="middle" style="padding-top: 15px; padding-left: 5px;">
                                            <table cellpadding="0" align="center" cellspacing="0" width="100%" height="40px">
                                                <tr>
                                                    <td class="style8">
                                                        Set Filter Criteria Option so that customer can easily search product.
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding-left: 20px;">
                                            <asp:LinkButton ID="lnkFilterOptionCancel" runat="server" Text="" CssClass="gridPagerlink"
                                                ForeColor="Black">Close <b>X</b></asp:LinkButton>
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                        </asp:Panel>
                    </td>
                    <td width="4px">
                    </td>
                    <td class="logBox">
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <asp:DropDownList ID="drpFilterOption" runat="server" Width="150px" Enabled="false">
                                </asp:DropDownList>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td class="logText">
                        &nbsp;
                    </td>
                    <td width="4px">
                    </td>
                    <td class="logBox">
                        &nbsp;
                        <asp:UpdatePanel ID="cancel" runat="server">
                            <ContentTemplate>
                                <asp:Button ID="btnAdd" runat="server" Style="font-weight: 700; text-align: right"
                                    Text="Add" CssClass="Login-btn" OnClick="btnAdd_Click" />
                            </ContentTemplate>
                        </asp:UpdatePanel>

            </td> </tr>
            <tr>
                <td>
                    &nbsp;&nbsp;
                </td>
                <td colspan="2">
                </td>
            </tr>
            <tr>
                <td align="center" colspan="3">
                    <asp:Panel ID="pnlAddFilter" runat="server" style="display:none">
                        <table id="list">
                        </table>
                        <div id="pager" style="text-align: center;">
                        </div>
                        <br />
                      </asp:Panel>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>

            </tr>
            </table>

事件是

protected void btnAdd_Click(object sender, EventArgs e)
    {
        pnlAddFilter.Style.Add("display", "block");
        //pnlAddFilter.Visible = true;
        DataTable dtFilter = new DataTable();
        dtFilter.Columns.Add("FOId");
        dtFilter.Columns.Add("Filtername");
        dtFilter.Columns.Add("FilterOption");
        DataRow drFilter;
        if (Session["Filter"] != null)
        {
            dtFilter = (DataTable)Session["Filter"];
        }

        drFilter = dtFilter.NewRow();
        drFilter["FOId"] = drpFilterOption.SelectedValue;
        drFilter["Filtername"] = drpFilter.SelectedItem.Text;
        drFilter["FilterOption"] = drpFilterOption.SelectedItem.Text;
        dtFilter.Rows.Add(drFilter);
        Session["Filter"] = dtFilter;
        btnAdd.Enabled = false;
        if (Session["Filter"] == null)
        {
          //  pnlAddFilter.Visible = false;
            pnlAddFilter.Style.Add("display", "none");
        }
        else
        {
            pnlAddFilter.Style.Add("display", "block");
          //  pnlAddFilter.Visible = true;
        }
        lblSuccess.Visible = true;
        lblSuccess.Text = AppHardcodeValue.strAddFilterProduct; 
    }      

i am using model popup in asp.net on this linkbutton

<asp:LinkButton ID="LinkButton1" runat="server"  CssClass="addProduct-disable" Enabled ="false" Text="Assign Filter Criteria"  CausesValidation="true"                    ></asp:LinkButton>

when i click a button in popup the event is getting fired but the asp panel and label are not getting displayed

<table cellpadding="0" cellspacing="0" width="100%">
                <tr>
                    <td colspan="3" class="style3" align="center">
                        Assign Filtering Criteria
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                         
                        <asp:Label ID="lblSuccess" runat="server" Text="" ></asp:Label>    

                    </td>
                </tr>
                <tr>
                    <td class="logText" width="30%">
                        Filter:
                        <asp:ImageButton ID="imgFilter" runat="server" ImageUrl="../images/helpIcon.png"
                            border="0" CausesValidation="false" OnClientClick="return showHelp('ctl00_ContentPlaceHolder1_pnlFilterHelp');" />
                        <cc1:ModalPopupExtender ID="mdlFilter" runat="server" TargetControlID="imgFilter"
                            PopupControlID="pnlFilterHelp" DropShadow="false" CancelControlID="lnkFilterCancel"
                            X="410" Y="200" />
                        <asp:Panel ID="pnlFilterHelp" runat="server" Height="70px" Width="170px" Style="display: none;">
                            <asp:Panel ID="pnlFilterOuter" runat="server" CssClass="modalPopup2" Height="100px"
                                Width="180px" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" BackColor="#FFFCF9">
                                <table cellpadding="0" cellspacing="0" width="90%">
                                    <tr>
                                        <td align="center" valign="middle" style="padding-top: 15px; padding-left: 5px;">
                                            <table cellpadding="0" align="center" cellspacing="0" width="100%" height="40px">
                                                <tr>
                                                    <td class="style8">
                                                        Set Filter Criteria so that customer can easily search product.
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                             
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding-left: 20px;">
                                            <asp:LinkButton ID="lnkFilterCancel" runat="server" Text="" CssClass="gridPagerlink"
                                                ForeColor="Black">Close <b>X</b></asp:LinkButton>
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                        </asp:Panel>
                    </td>
                    <td width="4px">
                    </td>
                    <td class="logBox">
                        <asp:UpdatePanel ID="filter" runat="server">
                            <ContentTemplate>
                                <asp:DropDownList ID="drpFilter" runat="server" AutoPostBack="True" OnSelectedIndexChanged="drpFilter_SelectedIndexChanged"
                                    Width="150px">
                                </asp:DropDownList>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                         
                    </td>
                </tr>
                <tr>
                    <td class="logText">
                        Filter Option:
                        <asp:ImageButton ID="imgFilterOption" runat="server" ImageUrl="../images/helpIcon.png"
                            border="0" CausesValidation="false" OnClientClick="return showHelp('ctl00_ContentPlaceHolder1_pnlFilterOption');" />
                        <cc1:ModalPopupExtender ID="mdlFilterOption" runat="server" TargetControlID="imgFilterOption"
                            PopupControlID="pnlFilterOption" DropShadow="false" CancelControlID="lnkFilterOptionCancel"
                            X="410" Y="220" />
                        <asp:Panel ID="pnlFilterOption" runat="server" Height="70px" Width="170px" Style="display: none;">
                            <asp:Panel ID="pnlFilterOptionOuter" runat="server" CssClass="modalPopup2" Height="300px"
                                Width="580px" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" BackColor="#FFFCF9">
                                <table cellpadding="0" cellspacing="0" width="90%">
                                    <tr>
                                        <td align="center" valign="middle" style="padding-top: 15px; padding-left: 5px;">
                                            <table cellpadding="0" align="center" cellspacing="0" width="100%" height="40px">
                                                <tr>
                                                    <td class="style8">
                                                        Set Filter Criteria Option so that customer can easily search product.
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                             
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding-left: 20px;">
                                            <asp:LinkButton ID="lnkFilterOptionCancel" runat="server" Text="" CssClass="gridPagerlink"
                                                ForeColor="Black">Close <b>X</b></asp:LinkButton>
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                        </asp:Panel>
                    </td>
                    <td width="4px">
                    </td>
                    <td class="logBox">
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <asp:DropDownList ID="drpFilterOption" runat="server" Width="150px" Enabled="false">
                                </asp:DropDownList>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                         
                    </td>
                </tr>
                <tr>
                    <td class="logText">
                         
                    </td>
                    <td width="4px">
                    </td>
                    <td class="logBox">
                         
                        <asp:UpdatePanel ID="cancel" runat="server">
                            <ContentTemplate>
                                <asp:Button ID="btnAdd" runat="server" Style="font-weight: 700; text-align: right"
                                    Text="Add" CssClass="Login-btn" OnClick="btnAdd_Click" />
                            </ContentTemplate>
                        </asp:UpdatePanel>

            </td> </tr>
            <tr>
                <td>
                      
                </td>
                <td colspan="2">
                </td>
            </tr>
            <tr>
                <td align="center" colspan="3">
                    <asp:Panel ID="pnlAddFilter" runat="server" style="display:none">
                        <table id="list">
                        </table>
                        <div id="pager" style="text-align: center;">
                        </div>
                        <br />
                      </asp:Panel>
                </td>
            </tr>
            <tr>
                <td>
                     
                </td>
            </tr>
            <tr>

            </tr>
            </table>

event is

protected void btnAdd_Click(object sender, EventArgs e)
    {
        pnlAddFilter.Style.Add("display", "block");
        //pnlAddFilter.Visible = true;
        DataTable dtFilter = new DataTable();
        dtFilter.Columns.Add("FOId");
        dtFilter.Columns.Add("Filtername");
        dtFilter.Columns.Add("FilterOption");
        DataRow drFilter;
        if (Session["Filter"] != null)
        {
            dtFilter = (DataTable)Session["Filter"];
        }

        drFilter = dtFilter.NewRow();
        drFilter["FOId"] = drpFilterOption.SelectedValue;
        drFilter["Filtername"] = drpFilter.SelectedItem.Text;
        drFilter["FilterOption"] = drpFilterOption.SelectedItem.Text;
        dtFilter.Rows.Add(drFilter);
        Session["Filter"] = dtFilter;
        btnAdd.Enabled = false;
        if (Session["Filter"] == null)
        {
          //  pnlAddFilter.Visible = false;
            pnlAddFilter.Style.Add("display", "none");
        }
        else
        {
            pnlAddFilter.Style.Add("display", "block");
          //  pnlAddFilter.Visible = true;
        }
        lblSuccess.Visible = true;
        lblSuccess.Text = AppHardcodeValue.strAddFilterProduct; 
    }      

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

極樂鬼 2024-09-20 17:14:30

根据我的经验,模式弹出窗口不能很好地支持动态渲染的数据。我认为您可能需要将模态内容放入更新面板中,以便能够使用服务器端代码来更新标签。

In my experience, the modal popup doesn't support dynamically rendered data very well. I'm thinking you probably need to put your modal content inside of an update panel in order to be able to use the server side code to update the label.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文