My datatable is not working. I am trying to use with gridview. Please can any one help me to solve.

My datatable is not working. I am trying to use with gridview. Please can any one help me to solve.

kakashi54321kakashi54321 Posts: 2Questions: 1Answers: 0
edited July 2020 in Free community support

Code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="dashboard.aspx.cs" Inherits="WebApplication1.dashboard" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server" style="background-color: gainsboro;">
   
    <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="icon" href="img/fav-icon.png" type="image/x-icon" />
         <title>Review</title>      
        <link href="css/font-awesome.min.css" rel="stylesheet">
        <link href="vendors/stroke-icon/style.css" rel="stylesheet">
        <link href="vendors/flat-icon/flaticon.css" rel="stylesheet">
        <link href="css/bootstrap.min.css" rel="stylesheet"> 
        <link href="vendors/revolution/css/settings.css" rel="stylesheet">
        <link href="vendors/revolution/css/layers.css" rel="stylesheet" />
        <link href="vendors/revolution/css/navigation.css" rel="stylesheet">
        <link href="vendors/animate-css/animate.css" rel="stylesheet">
        <link href="vendors/magnify-popup/magnific-popup.css" rel="stylesheet">
        <link href="vendors/owl-carousel/owl.carousel.min.css" rel="stylesheet">
        <link href="vendors/bootstrap-datepicker/bootstrap-datetimepicker.min.css" rel="stylesheet">
        <link href="vendors/bootstrap-selector/bootstrap-select.css" rel="stylesheet">
        <link href="vendors/lightbox/simpleLightbox.css" rel="stylesheet">
        <link href="css/style.css" rel="stylesheet">
        <!--<link href="css/responsive.css" rel="stylesheet">-->
        <link href="https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet">
        <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
        <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>      
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
        <link href=" https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css" rel="stylesheet"/>
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>

    <link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
    <script src="https://nightly.datatables.net/js/jquery.dataTables.js"></script>

               
         <script defer src="script.js"></script>
  
        <script>
            $(function () {
                $("#datepicker-13").datepicker();
            });
        </script>

        <script>
            $(function () {
                $("#datepicker-14").datepicker();

            });
        </script>
    <script>
        $(document).ready(function () {
            var table = $('#gvContact1').DataTable();
        });

    </script>

</head>
<body>
    <form id="form2" runat="server">
                  
       <section class="main_slider_area main_s_banner">
            <br />
            <asp:Label ID="LblRepresentativeDetail" runat="server" Text="WELCOME"></asp:Label>
           
           <br />
           <br />
           <br />
           <br />
           <br />             
           <br />
           <br />
           <br />
           <br />


        <div class="book_table_area">
            
            <div class="container">
                
                <br />
                 <br />
                
                <h4 class="book_single_text" >Daily Dashboard</h4>
            </div>
          </div>
           <br />
          
           <br />
            <br />

       <div style="position: relative; width: inherit; height: inherit">
             <asp:GridView ID="gvContact1" runat="server" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" Height="271px"  GridLines="Vertical" AutoGenerateColumns="False"  align="center"  Width="1175px"  >
                 <AlternatingRowStyle BackColor="White" />
               <Columns>
              <asp:BoundField DataField="NewID" HeaderText ="ID"  />
              <asp:BoundField DataField="Representative" HeaderText ="Name" />
                <asp:BoundField DataField="Activity" HeaderText ="Activity" />
                 <asp:BoundField DataField="Mission" HeaderText ="Mission" />
                   <asp:BoundField DataField="Country" HeaderText ="Country" />
                   <asp:BoundField DataField="City" HeaderText ="City" />
                  
                  
                   </Columns>
                <SortedAscendingCellStyle BackColor="#FBFBF2" />
                 <SortedAscendingHeaderStyle BackColor="#848384" />
                 <SortedDescendingCellStyle BackColor="#EAEAD3" />
                 <SortedDescendingHeaderStyle BackColor="#575357" />
           </asp:GridView>
           <br />

      </div>    
           
    <div >
<br />
</div>
                
    </section>

     
    <script src="js/bootstrap.min.js"></script>
   
    <script src="vendors/bootstrap-selector/bootstrap-select.js"></script>
   
        
   
    </form>
</body>
</html>

Edited by Kevin:  Syntax highlighting. Details on how to highlight code using markdown can be found in this guide

Answers

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951

    Please start by explaining the problem. Do you get error messages in the browser's console? Troubleshooting steps you have performed.

    Can you post a link to your page or a test case showing the problem so we can help?
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • kakashi54321kakashi54321 Posts: 2Questions: 1Answers: 0

    Thank you kevin for replying. It is debugging without any error. but no search button is showing. I tried with the link which has been share by you. But it is not showing the table on the test case.
    Link - http://live.datatables.net/fugukuxe/1/edit

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951

    The test case is getting this error:

    DataTables warning: Non-table node initialisation (ASP:GRIDVIEW). For more information about this error, please see http://datatables.net/tn/2

    See the link for information of how to fix the error. I'm guessing you aren't seeing this error on your page, is that correct?

    It is debugging without any error. but no search button is showing.

    In order to help we will need to see this issue replicated in a test case or a link to your page.

    Kevin

This discussion has been closed.