Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8078095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:40:59+00:00 2026-06-05T15:40:59+00:00

How to go about adding one arrow image (up or down) to a list

  • 0

How to go about adding one arrow image (up or down) to a list view’s header so that when you click on it it sorts the column by ascending/descending order?

Currently I just have a link that does the sorting:

<asp:LinkButton runat="server" ID="sortPosition" CommandName="Sort" CommandArgument="Position" >Position</asp:LinkButton>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:41:01+00:00Added an answer on June 5, 2026 at 3:41 pm

    There are many ways to do it. One is to do it on client side using jquery. You could add a span or div or image and toggle it with jquery depending on the sorting state.

    <style>
        .sortNotSelected
        {
            background-image: none;
            width: 15px;
            height: 15px;
        }
        .sortAscending
        {
            background-image: url('down.png');
            width: 15px;
            height: 15px;
        }
        .sortDescending
        {
            background-image: url('up.png');
            width: 15px;
            height: 15px;
        }
    
    </style>
    
    <asp:LinkButton runat="server" ID="sortPosition" CommandName="Sort" CommandArgument="Position" OnClientClick="changeSortState();">Position</asp:LinkButton>
    <span id="imgSortPosition" class="sortNotSelected"></span>
    
    <script>
        function changeSortState(){
            if ($('#imgSortPosition').attr('class') == 'sortNotSelected'){
                $('#imgSortPosition').removeClass();
                $('#imgSortPosition').addClass('sortAscending');
            }  
            else if ($('#imgSortPosition').attr('class') == 'sortAscending'){
                $('#imgSortPosition').removeClass();
                $('#imgSortPosition').addClass('sortDescending');
            }  
            else 
                $('#imgSortPosition').removeClass();
                $('#imgSortPosition').addClass('sortNotSelected');
            }  
    
        }
    </script>
    

    Another way to do it on the server side. You could add control and change ImageUrl property depending on the sort state on Command Sort

    <asp:ImageUrl ID="imgSort" runat="server" />
    

    Code behind

    if (sortAsc)
    {
        imgSort.ImageUrl = "up.png";
    }
    
    // and so on
    

    You would add this image to the layout template of the listview

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem adding arraylist to list view, will explain about my problem here..
How does one go about adding a click handler in the following example? I
I would like to know how one goes about adding functionality from one open
How does one go about adding JButton s among various other Swing GUI components
I have found a lot of information about adding form helper methods (see one
How would one go about adding an event handler to a control in a
How would I go about adding more drop down lists to a form, so
How would one go about adding a submenu item to the windows explorer context
I'm thinking about adding some kind of copy protection to one of my tools.
How would one go about adding fl.controls.* to AS3 projects developed under Linux? Apparently

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.