title: How to change index When row is selected In listview
body: <p>i'm beginner in Asp.net. I have this listview control which is populated by MSSQL database. Now i want to change listview index when listview row is selected.
  Below is coding for listview</p>
  <pre><code>&lt;asp:ListView ID=&quot;ListViewTask&quot; runat=&quot;server&quot; OnSelectedIndexChanged=&quot;ListViewTask_SelectedIndexChanged&quot; OnSelectedIndexChanging=&quot;ListViewTask_SelectedIndexChanging&quot;&gt;
     &lt;ItemTemplate&gt;
        &lt;div class=&quot;row&quot;&gt;
           &lt;div class=&quot;col-md-1&quot;&gt;
              &lt;asp:CheckBox ID=&quot;ChkTaskDone&quot; runat=&quot;server&quot; Checked='&lt;%#Eval(&quot;is_task_done&quot;)%&gt;' CommandName=&quot;Select&quot; OnCheckedChanged=&quot;ChkTaskDone_OnCheckedChanged&quot; AutoPostBack=&quot;True&quot; /&gt;
           &lt;/div&gt;
           &lt;div class=&quot;col-md-7&quot;&gt;
              &lt;asp:Label ID=&quot;llbTaskId&quot; runat=&quot;server&quot; Text='&lt;%#Eval(&quot;task_id&quot;)%&gt;' Visible=&quot;false&quot;&gt;&lt;/asp:Label&gt;
              &lt;asp:LinkButton ID=&quot;lnkbtnTaskName&quot; Style=&quot;width: auto&quot; runat=&quot;server&quot; Text='&lt;%#Eval(&quot;task_name&quot;)%&gt;' CommandName=&quot;Select&quot;&gt;&lt;/asp:LinkButton&gt;
           &lt;/div&gt;
           &lt;div class=&quot;col-md-2&quot;&gt;
              &lt;asp:Label class=&quot;badge badge-pill badge-dark float-right&quot; ID=&quot;llbProjectName&quot; runat=&quot;server&quot; Text='&lt;%#Eval(&quot;project_name&quot;)%&gt;'&gt;&lt;/asp:Label&gt;
           &lt;/div&gt;
           &lt;div class=&quot;col-md-2&quot;&gt;
              &lt;asp:LinkButton Class=&quot;float-right&quot; ID=&quot;lnkbtnDueDate&quot; runat=&quot;server&quot; Text='&lt;%#Eval(&quot;due_date&quot;,&quot;{0:d MMM}&quot;)%&gt;' align=&quot;left&quot;&gt;&lt;/asp:LinkButton&gt;
           &lt;/div&gt;
        &lt;/div&gt;
        &lt;hr /&gt;
     &lt;/ItemTemplate&gt;
  &lt;/asp:ListView&gt;
  </code></pre>
  <p>i can change listview index by simply add select command on asp:Button but i want to do it on row</p>
  <p>gave up as I looked at posts and searched google for examples and none fit my situation
  Can you please help me identify where am I going wrong and what should be done to achieve the goal.</p>
  <p>Any help is highly appreciated.</p>
  <p>Thanks</p>
  <p><strong>UPDATE :</strong></p>
  <p><a href="https://stackoverflow.com/a/63986734?noredirect=1">Albert D. Kallal</a>'s Answer work well for me. This is my code below in page_load event in C# language</p>
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      if (Request[&quot;__EVENTTARGET&quot;] == &quot;RowJump&quot;)
      {
  
          string ix = Request[&quot;__EVENTARGUMENT&quot;];
  
  
          ListViewItem item = ListViewTask.Items[Convert.ToInt32(ix)];
          Label getTaskId = (Label)item.FindControl(&quot;llbTaskId&quot;);
  
          //then use
          string TaskId = getTaskId.Text; // you get the value or the text of the Label 
          // Do something with TaskId
      }
  }
  </code></pre>
  <p>In my case i retrieve selectedIndex of Row and then get the value of TaskId lable which is 'visible = false' in html and then do some Sql Operation from that task Id</p>