How to use paging with Repeater control in ASP.NET?

<asp:Repeater ID="RepCourse" runat="server"> <ItemTemplate> <div style="width:400px"></div> <div class="course" style="float: left; margin-left: 100px; margin-top: 100px"> <div class="image"> <asp:Image ID="imgteacher" runat="server" Height="150" Width="248" ImageUrl='<%# "ShowImage.ashx?id="+ DataBinder.Eval(Container.DataItem, "CourseID") %>'/> </div> <div style="margin-left: 3px; width: 250px"> <div class="name"> <a href="#" rel="nofollow noreferrer noopener" rel="nofollow noreferrer noopener"><asp:Label runat="server" ID="lblname" Text='<%#Eval("CourseName") %>'></asp:Label></a> </div> <div style="height: 13px"></div> <div id="teacher"> <a href="#" rel="nofollow … Read more

GridView sorting & paging

I would like to display simple gridview on my page and provide sorting and paging functionality to it. Sorting and paging individually is working ok, but the combination of both does not. For example if I sort the first column descending and then go to page number two, then I see the second page of data with default sorting (ascending).