Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i have the following repeater and i want to sort it by li elements in item template..


<asp:Repeater ID="rptSample" runat="server" ClientIDMode="Static"
    EnableViewState="false">
    <HeaderTemplate>
    <%--<div class="rt_header1">
<ul>
<li class="flight">Airline</li>
<li>Departure</li>
<li class="lft">Arrival</li>
<li class="dur">Duration</li>
<li class="lft">Fare</li>
<li class="lft">Arrival</li>
<li class="dur">Duration</li>
<li class="lft">Fare</li>
</ul>
</div>--%>
    <ul id="sort-list" class="asc">
        <table id="tbl" cellpadding="0" cellspacing="0" border="0" class="display">

        <thead>
            <tr><td>Student ID</td><td>Rollno</td><td>Studentname</td><td>Parentname</td>
            <td>Mobileno</td><td>Gender</td><td>Class</td><td>Section</td></tr>
           
       </thead>
            <tbody> 
     </tbody>
           
        </table>
       
    </HeaderTemplate>
   <ItemTemplate>
<%--<li  runat="server" ></li>--%>
<li class="airline" > <%#DataBinder.Eval(Container, "DataItem.Stu_ID")%></li>
<li class="airline"><%#DataBinder.Eval(Container, "DataItem.Rollno")%></li>
<%--<li><asp:Label ID="Label4" runat="server" Text='<%#Eval("Rollno") %>' Font-Bold="true"/></li>--%>
<li><%#DataBinder.Eval(Container, "DataItem.Studentname")%></li>

<li ><asp:Label ID="Label2" runat="server" Text='<%#Eval("Parentname") %>' Font-Bold="true"/></li>
<li><%#DataBinder.Eval(Container, "DataItem.Mobileno")%></li>
<li><asp:Label ID="Label6" runat="server" Text='<%#Eval("Gender") %>' Font-Bold="true"/></li>
<li><asp:Label ID="Label7" runat="server" Text='<%#Eval("Class") %>' Font-Bold="true"/></li>

<li><asp:Label ID="Label8" runat="server" Text='<%#Eval("Section") %>' Font-Bold="true"/></li>



</ItemTemplate>


    <FooterTemplate>
 </ul>
    </FooterTemplate>
</asp:Repeater>
Posted

1 solution

I had a similar problem not long ago and sorted it with JQuery. Have a look on this link
http://www.designchemical.com/blog/index.php/jquery/sort-items-alphabetically-using-jquery/[^]
It should help you to do the sorting.
 
Share this answer
 
Comments
sridhargiri 4-Oct-13 0:44am    
Thank you.It works for smaller tables and lists but nor for large tables.. Anyway Thank you so much..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900