CSS and java script in Update Panel



You need to create one .aspx page and write below code.
Select2 : Select2 is dropdownlist search.
Issue Resolve : Select2 is not working when page is refresh by button.

 You need to add below html in page.
  1. <asp:UpdatePanel ID="upMauin" runat="server">    
  2.     <ContentTemplate>    
  3.     <script type="text/javascript"> Sys.Application.add_load(UpdateIsPostBack); </script>    
  4. ......................    
  5. <div>    
  6. <asp:DropDownList runat="server" ID="DropTransactionType" ValidationGroup="Request" AutoCompleteType="Disabled" class="form-control select2" AutoPostBack="true" OnSelectedIndexChanged="DropTransactionType_SelectedIndexChanged">    
  7.                                             <asp:ListItem Text="Cash Withdrawal" Value="1"></asp:ListItem>    
  8.                                             <asp:ListItem Text="Balance Enquiry" Value="2"></asp:ListItem>    
  9.                                             <asp:ListItem Text="Mini Statement" Value="3"></asp:ListItem>    
  10.                                         </asp:DropDownList>    
  11. </div>   
  12. </ContentTemplate>  
  13. </asp:UpdatePanel>  
 You need to add below script in page header.
  1. <script type="text/javascript">  
  2.         //On UpdatePanel Refresh  
  3.         function UpdateIsPostBack() {  
  4.             $(".select2").select2();  
  5.         }  
  6.     </script>  

0 Comment's

Comment Form

Submit Comment