ScrollX using aspRepeater

ScrollX using aspRepeater

carolcruzcarolcruz Posts: 3Questions: 1Answers: 0

When I use asp Repeater, the second iteration doesnt come with the table properties like scrollX.
I already tried this solution with no success.
Please, help me!

          var table = $('#dadosCadastrais02').DataTable({
             searching: false,
             info: false,
             scrollX: true,
             "scrollX": true,
             paging: false,
             ordering: false,


The Asp.Net Code:

       <asp:Repeater ID="rptValidadorD02" runat="server"  >
                             <table id="dadosCadastrais02" class="table table-striped table-bordered" style="width:100%" >
                 <h5>DADOS CADASTRAIS</h5>
            <th>Status Validação</th>
            <th>Tipo de Registro</th>
            <th>Tipo da pessoa</th>
            <th>Tipo do proponente</th>
            <th>Tipo CPF</th>

  <tbody>   </HeaderTemplate><ItemTemplate> 
            <td><%# DataBinder.Eval(Container.DataItem,"status02") %></td>
            <td><%# DataBinder.Eval(Container.DataItem,"tipoderegistro02") %></td>
            <td><%# DataBinder.Eval(Container.DataItem,"sequencial02") %></td>
            <td><%# DataBinder.Eval(Container.DataItem,"tipodapessoa02") %></td>
            <td><%# DataBinder.Eval(Container.DataItem,"tipodoproponente02") %></td>
            <td><%# DataBinder.Eval(Container.DataItem,"cpfCnpj02") %></td>
            <td><%# DataBinder.Eval(Container.DataItem,"tipocpf02") %></td>
            <td><%# DataBinder.Eval(Container.DataItem,"nacionalidade02") %></td>
            <td><%# DataBinder.Eval(Container.DataItem,"nome02") %></td>




  • colincolin Posts: 12,948Questions: 0Answers: 2,206

    It looks like your </HeaderTemplate> is inside the <tbody> - I'm not familiar with ASP but that looks like bad HTML formatting to me. Ditto the <FooterTemplate> is within the </tbody>,


  • carolcruzcarolcruz Posts: 3Questions: 1Answers: 0

    Hi @colin that´s is the correct structure.
    We need to do it this way because <tbody> can´t repeat.

    See that:

  • allanallan Posts: 54,909Questions: 1Answers: 8,606 Site admin

    Can you show us what your rendered HTML looks like please?


  • carolcruzcarolcruz Posts: 3Questions: 1Answers: 0

    @allan here it is.
    I couldn´t attach it here.

    Pay attention in "Dados Cadastrais" section.
    The first one has ScrollX property ok. The second one didn´t pickup any JS config.

  • allanallan Posts: 54,909Questions: 1Answers: 8,606 Site admin

    Oh I see - you're HTML isn't valid as you'll have two table elements with the same id. An id must be unique in the document.

    Remove the id="dadosCadastrais02" and you could initialise the DataTable using:


    If you have other tables on the page which you don't want to be DataTables, then add a class to the tables you do want to enhance and select that instead.


Sign In or Register to comment.