title: Using arrows to change the order in which things are displayed in a GridView in ASP.NET
body: <p>I am trying to use images representing arrows to allow the user to change the order in which items appear in a list in a grid view in ASP.NET.</p>
  <p>I have a class which has a value named &quot;position&quot;, the class is displayed inside the GridView and is ordered by position. In each of the rows of the gridview are an up and down arrow which i want to change the value of &quot;position&quot; for the object represent by the row of the gridview. Whats the easiest way to do this?</p>
  <p>ASP -</p>
  <pre><code>&lt;br /&gt;&lt;strong&gt;Previous Employment: &lt;/strong&gt; &lt;br /&gt;
                  Pick one of your previous employers listed below to update/delete or &lt;asp:HyperLink ID=&quot;PreviousEmploymentLink&quot; runat=&quot;server&quot; /&gt;.
                  &lt;asp:GridView runat=&quot;server&quot; ID=&quot;EmploymentDataGrid&quot; AutoGenerateColumns=&quot;false&quot; OnRowDeleting=&quot;EmploymentDataGrid_onDeleting&quot; 
                  DataKeyNames=&quot;EmployerId&quot; SkinID=&quot;FullWidthGrid&quot; &gt;
                  &lt;EmptyDataTemplate&gt;
                  &lt;p&gt;No Previous Employment added yet&lt;/p&gt;
                  &lt;/EmptyDataTemplate&gt;
                      &lt;Columns&gt;
                              &lt;asp:BoundField HeaderText=&quot;Dates&quot; DataField=&quot;Dates&quot; /&gt;
                              &lt;asp:BoundField HeaderText=&quot;Employer's Name&quot; DataField=&quot;EmployerName&quot; /&gt;
                              &lt;asp:BoundField HeaderText=&quot;Job Description&quot; DataField=&quot;JobDescription&quot; /&gt;
                              &lt;asp:BoundField HeaderText=&quot;Job Title&quot; DataField=&quot;JobTitle&quot; /&gt;
                              &lt;asp:HyperLinkField HeaderStyle-Width=&quot;30px&quot; DataNavigateUrlFields=&quot;EmployerId&quot;
                              HeaderText=&quot;Edit&quot; Text=&quot;&lt;img src='../../../Images/edit.gif' alt='Edit Employment' border='0'/&gt;&quot;
                              DataNavigateUrlFormatString=&quot;UpdatePreviousEmployment.aspx?PreviousEmploymentId={0}&quot; /&gt;
                              &lt;asp:TemplateField HeaderText=&quot;Delete&quot; ItemStyle-HorizontalAlign=&quot;Center&quot; HeaderStyle-Width=&quot;45px&quot;&gt;
                                  &lt;ItemTemplate&gt;
                                      &lt;asp:ImageButton AlternateText=&quot;Delete User&quot; ID=&quot;DeleteButton&quot; runat=&quot;server&quot; CommandName=&quot;Delete&quot; ImageUrl=&quot;~/Images/delete.gif&quot; /&gt;
                                  &lt;/ItemTemplate&gt;
                              &lt;/asp:TemplateField&gt;
                              &lt;asp:TemplateField HeaderText=&quot;Position&quot; ItemStyle-HorizontalAlign=&quot;Center&quot; HeaderStyle-Width=&quot;45px&quot;&gt;
                                  &lt;ItemTemplate&gt;
                                      &lt;asp:ImageButton AlternateText=&quot;Move Up&quot; ID=&quot;UpPositionButton&quot; runat=&quot;server&quot; CommandName=&quot;MoveEmploymentUp&quot; OnClick=&quot;MoveEmploymentUp&quot; ImageUrl=&quot;~/Images/arrow_up_green.gif&quot; /&gt;
                                      &lt;asp:ImageButton AlternateText=&quot;Move Down&quot; ID=&quot;DownPositionButton&quot; runat=&quot;server&quot; CommandName=&quot;MoveEmploymentDown&quot; ImageUrl=&quot;~/Images/arrow_down_green.gif&quot; /&gt;
                                  &lt;/ItemTemplate&gt;
                              &lt;/asp:TemplateField&gt;
                      &lt;/Columns&gt;
                  &lt;/asp:GridView&gt;
  </code></pre>