Asp.net button not firing on modal pop up extender

I have a TabPanelcontroller having the grid view. On grid row selection a modal popup extender shows the detail of that row... It has a submit button btn_Approve_Approved which should perform some database operation and refresh the grid.

The button btn_Approve_Approved was not firing untill i was using the OkControlId of Modal Popup extender. To get the modal pop up buttons work you should remove the OkcontrolID and CancelControlID. And write your own code for your buttons...


              <!-- Start of Modal Popup for Leave approval just below the concerned grid view -->
              <asp:Button runat="server" ID="btnShowModalPopup" style="display:none"/>    
          <asp:ModalPopupExtender ID="ModalPopupExtender_Approve" runat="server" TargetControlID="btnShowModalPopup" PopupControlID="up_Modal_Approve" BackgroundCssClass="modalBackground" dropshadow="true"  PopupDragHandleControlID="panelDragHandle"  ></asp:ModalPopupExtender>
    <div id="LeaveApproveModalSection">
     <asp:UpdatePanel ID="up_Modal_Approve" runat="server" CssClass="modalpopup"  style="display:none">
   <ContentTemplate>
   <div class="insidemodalpopup">
   <asp:Panel runat="Server" ID="panelDragHandle" CssClass="drag">
                            Hold here to Drag this Box
                    </asp:Panel>
              <center>    <h3> Leave Approve </h3> <br /> </center> 
               <asp:Label ID="lbl_Approve_Tx" runat="server" Text="Loading Leave Details "></asp:Label>
                <br /> 
                  <asp:Label ID="lbl_Approve_Detail" runat="server" Text=" "></asp:Label>
                <br />
           <center>    <asp:Button ID="btn_Approve_Approved" runat="server" Text="Approve"  
                   BorderWidth="2px" BorderColor="Green" 
                   CausesValidation="False" 
                   ValidationGroup="vg1" />
           <asp:Button ID="btn_Approve_Reject" runat="server" Text="Reject"  BorderWidth="2px" BorderColor="Green"/></center>  
   </div>
   </ContentTemplate>
     </asp:UpdatePanel>
       <asp:Button runat="server" ID="hiddenTargetControlForModalPopup" style="display:none"/>
        </div>
          <!-- end #of Modal Popup for Leave approval -->




VB Code



 Protected Sub btn_Approve_Approved_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_Approve_Approved.Click
        Dim tmp = SetLeaveTransactionDetails(lbl_Approve_Tx.Text, "Approved", Session("eid") + Now.ToString)
        If tmp = "ok" Then
            ModalPopupExtender_Approve.Hide()
        Else
            lbl_Approve_Detail.Text = "Unable to Approve Leave" & tmp
            ModalPopupExtender_Approve.Show()
        End If


    End Sub

Comments

Popular Posts