ModalPopupExtender with extra buttons

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • E11esar
    New Member
    • Nov 2008
    • 132

    ModalPopupExtender with extra buttons

    Hello there.

    I have an asp.net (C#) page utilising the ModalPopupExten der. All is working fine except I have two buttons on the panel (along with a DropDownList of results) that is displayed and if either button is selected, then this has the effect of the "OkControlI d" button being selected.

    In the ModalPopup tag I have the OkButtonControl Id set to "btnSelecte d" but the popup panel also has a button called "btnSearch" .

    It is this second button that causes the popup to be terminated. If I invoke the popup again, I can see the dropdownlist is populated correctly and can then select an item and select the OK button.

    I have looked at several options for this, such as the UseSubmitBehavi or attribute for the button (btnSearch) but still the popup is being dismissed too early.

    Any ideas where I am going wrong please?

    Thank you.

    M :o)
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Can you post some of your code? What is invoked when the button is clicked?

    Comment

    • E11esar
      New Member
      • Nov 2008
      • 132

      #3
      ModalPopupExten der

      Hi there.

      I won't post the full aspx file as it is huge but I have been able to trim it down sufficiently to show what is what and hopefully enable you to work out what I have done wrong here. Just as a brief page structure overview, I am using the following hierarchy in the page:

      MasterPage

      UpdatePanel (UpdateMode="Al ways")

      Panel | ModalPopupExten der

      Table | LinkButton

      Here is a sample of the ModalPopup:

      Code:
      <%--*********************************** ModalPopup for Search*************************************--%> 
      <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderStreet" runat="server" TargetControlID="lbStreet" 
      
      PopupControlID="StreetPanel" BackgroundCssClass="modalBackGround" DropShadow="true"
      
      OkControlID="btnSelectStreet" >
      
      </ajaxToolkit:ModalPopupExtender> 
      <asp:Panel ID="StreetPanel" runat="server" CssClass="modalPopup" BackColor="#DAEAEB" Width="500px" OnLoad="streetPanel_OnLoad">
      
      <table>
      
      <tr>
      
      <td><asp:TextBox ID="txtStreetSearch" runat="server" Width="250px" Text="%"></asp:TextBox>
      
      <asp:Button ID="btnSearchStreet" runat="server" Text="Search" OnClick="btnSearchStreet_Click" />
      
      </td>
      
      </tr>
      
      <tr>
      
      <td><asp:DropDownList ID="dlStreetResults" runat="server" AutoPostBack="true" 
      OnSelectedIndexChanged="dlStreetResults_SelectedIndexChanged"></asp:DropDownList></td>
      
      </tr>
      
      <tr>
      
      <td><asp:Button ID="btnSelectStreet" runat="server" Text="OK" /></td>
      
      </tr>
      
      </table>
      
      </asp:Panel>
      
      <%--********************************************************************************--%>
      This is the TargetControl

      Code:
      <td><asp:LinkButton ID="lbStreet" Text="Street" runat="server"></asp:LinkButton></td>

      If you need anything else then please ask and thank you for your help.

      Mark :o)

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Can you post the client-side version of this code (view source in the browser). Also post the code that is called (the function) when you click the button.

        Comment

        Working...