本文介绍了如何在textchange事件中显示modalpopupextender的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





这里我的问题是如何在textchange事件发生时显示popextender ...



我的设计代码:





Here my problem is How to show popextender when textchange event fire...

My Design code:

<form id="form1" runat="server">
   <div style="min-height: 700px;">
       <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
       </asp:ToolkitScriptManager>
       <asp:Button ID="Button1" runat="server" Text="Click here to show the modal" />
       <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="true"

           ontextchanged="TextBox1_TextChanged"></asp:TextBox>
       <asp:ModalPopupExtender ID="ModalPopupExtender1" BackgroundCssClass="ModalPopupBG"

           runat="server" CancelControlID="btnCancel" OkControlID="btnOkay" TargetControlID="Button1"

           PopupControlID="Panel1" PopupDragHandleControlID="PopupHeader" >
       </asp:ModalPopupExtender>
       <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
       <ContentTemplate>
       <div id="Panel1" style="display: none;" class="popupConfirmation">
           <div class="popup_Container">
               <div class="popup_Titlebar" id="PopupHeader">
                   <div class="TitlebarLeft">Popup Header</div>
                   <div class="TitlebarRight"></div>
               </div>
               <div class="popup_Body">
                   <asp:Repeater ID="Rptr_popup" runat="server">
                   <ItemTemplate>
                  <%-- <asp:LinkButton ID="lnkbtn_Contperson" runat="server" Text='<%# Eval("contname")%>'></asp:LinkButton>--%>
                   <asp:RadioButton ID="RadioButton1" runat="server"  Text='<%# Eval("contname")%>' TextAlign="Left"/>
                   </ItemTemplate>
                   </asp:Repeater>
               </div>
               <div class="popup_Buttons">
                   <input id="btnOkay" value="Done" type="button" />
                   <input id="btnCancel" value="Cancel" type="button" />
               </div>
           </div>
       </div>
       </ContentTemplate>
       <Triggers>
       <asp:AsyncPostBackTrigger ControlID="TextBox1" />
       </Triggers>
       </asp:UpdatePanel>
   </div>
   </form>





CS代码:





CS code:

protected void TextBox1_TextChanged(object sender, EventArgs e)
        {

            ModalPopupExtender1.Show();
        }

推荐答案

<form id="form1" runat="server">
   <div style="min-height: 700px;">
       <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
       </asp:ToolkitScriptManager>
          <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
       <ContentTemplate>
       <asp:Button ID="Button1" runat="server" Text="Click here to show the modal" />
       <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="true" ontextchanged="TextBox1_TextChanged"
          ></asp:TextBox>
       <asp:ModalPopupExtender ID="ModalPopupExtender1" BackgroundCssClass="ModalPopupBG"
           runat="server" CancelControlID="btnCancel" OkControlID="btnOkay" TargetControlID="Button1"
           PopupControlID="Panel1" PopupDragHandleControlID="PopupHeader" >
       </asp:ModalPopupExtender>
    
       <div id="Panel1" style="display: none;" class="popupConfirmation">
           <div class="popup_Container">
               <div class="popup_Titlebar" id="PopupHeader">
                   <div class="TitlebarLeft">Popup Header</div>
                   <div class="TitlebarRight"></div>
               </div>
               <div class="popup_Body">
                   <asp:Repeater ID="Rptr_popup" runat="server">
                   <ItemTemplate>
                  <%-- <asp:LinkButton ID="lnkbtn_Contperson" runat="server" Text='<%# Eval("contname")%>'></asp:LinkButton>--%>
                   <asp:RadioButton ID="RadioButton1" runat="server"  Text='<%# Eval("contname")%>' TextAlign="Left"/>
                   </ItemTemplate>
                   </asp:Repeater>
               </div>
               <div class="popup_Buttons">
                   <input id="btnOkay" value="Done" type="button" />
                   <input id="btnCancel" value="Cancel" type="button" />
               </div>
           </div>
       </div>
       </ContentTemplate>
       <Triggers>
       <asp:AsyncPostBackTrigger ControlID="TextBox1" />
       </Triggers>
       </asp:UpdatePanel>
   </div>
   </form>


这篇关于如何在textchange事件中显示modalpopupextender的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 12:17