如何在模态扩展器中触发事件 [英] how to event fire in modal Extender

查看:77
本文介绍了如何在模态扩展器中触发事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个模态弹出扩展器,这是隐藏弹出窗口。我在Popup中使用gridview。但没有事件触发OnRowcommand。以下aspx



Hi I have a modal pop up extender and this is hide popup .i take a gridview in Popup . But no event fire OnRowcommand .Following aspx

<pre lang="xml"><asp:Panel ID="pnlPopup" runat="server" Width="700" Style="display: none;" >
                                <div id="divSimplePopup" class="popup">
                                <div class="headerpop" runat="server" id="aa">
                                    <span id="lblPopupHeader" class="msg">Requisition</span>
                                </div>

                                    <asp:UpdatePanel ID="upDatePanl" runat="server" UpdateMode="Conditional">
                                        <ContentTemplate>
                                            <asp:Button ID="btnShowPopup" runat="server" Text="Button" Style="display: none;" />
                                            <cc1:ModalPopupExtender CancelControlID="btnClose" ID="mdlPopup" runat="server" TargetControlID="btnShowPopup"

                                                PopupControlID="pnlPopup">
                                            </cc1:ModalPopupExtender>
                                            <asp:GridView ID="grdReq" runat="server" AutoGenerateColumns="False" BackColor="White"

                                                BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" Font-Size="Small"

                                                GridLines="Vertical" HorizontalAlign="Center" Width="100%" Visible="false" AllowPaging="true"

                                                PageSize="10" OnRowCommand="grdReq_RowCommand" >
                                                <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
                                                <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
                                                <Columns>
                                                <asp:TemplateField HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Center">
                                                        <HeaderTemplate>
                                                            Select
                                                        </HeaderTemplate>
                                                        <ItemTemplate>
                                                            <asp:RadioButton ID="rdoButton" runat="server" OnSelectedIndexChanged="rdoButton_CheckedChanged"

                                                                AutoPostBack="True"></asp:RadioButton>
                                                        </ItemTemplate>
                                                        <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                                                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                                    </asp:TemplateField>
                                                   <asp:TemplateField HeaderText="ID" Visible="true">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblId" runat="server" Text='<%# Eval("RequisitionID") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                                </Columns>
                                            </asp:GridView>

                                        </ContentTemplate><pre lang="HTML">



< / asp:UpdatePanel>




</asp:UpdatePanel>

<div class="footerpop">
                                  <input class="button_popup" id="btnClose" type="submit" value="Cancel" />
                              </div>
                              </div>
                              </asp:Panel>







aspx.cs






aspx.cs

this.grdReq.RowCommand += new GridViewCommandEventHandler(grdReq_RowCommand);
void grdReq_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            RadioButton rdb = FindControl("rdoButton") as RadioButton;
            foreach (GridViewRow row in grdReq.Rows)
            {
                if (rdb.Checked == true)
                {
                    ddlRequisitionID.Text = row.Cells[1].ToString();
                }
            }

        }



这个grdReq.​​RowCommand + =新的GridViewCommandEventHandler(grdReq_RowCommand)无法触发。但是为什么。请帮助我


this grdReq.RowCommand += new GridViewCommandEventHandler(grdReq_RowCommand) can not fire .but why. pls help me

推荐答案

因为你只是改变''event'中的选择,你最好写jquery来做没有回发的客户端。一般来说,你最好停止将竞争的MS库放在彼此之上,并使用jquery。
As you''re just changing selections in your ''event'', you''d do better to write jquery to do it on the client without a postback. In general, you''d do well to stop laying competing MS libraries on top of each other, and use jquery.


这篇关于如何在模态扩展器中触发事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆