title: How I use the ItemCommand Event for my ListView in my ASP.NET Application
body: <p>I have a ASP.NET Application with a ListView. In every Row in my ListView I have a LinkButton that open a new webform "Benutzer.aspx". my Problem is that I don't get the Index of this Row. I use the ItemCommand Event but it not work :(</p>
  
  <p>Here my Code:</p>
  
  <p>ASPX:</p>
  
  <pre><code>...
  
          &lt;ItemTemplate&gt;
  
              &lt;tr runat="server"&gt; 
  
                  &lt;td align="left" &gt;&lt;asp:Label ID="Label1" Text='&lt;%# Eval("Benutzer") %&gt;' runat="server" /&gt;&lt;/td&gt;
                  &lt;td align="left"&gt;&lt;asp:Label ID="Label2" Text='&lt;%# Eval("eMail") %&gt;' runat="server" /&gt;&lt;/td&gt;
                  &lt;td align="left"&gt;&lt;asp:Label ID="Label3" Text='&lt;%# Eval("Vorname") %&gt;' runat="server" /&gt;&lt;/td&gt;
                  &lt;td align="left"&gt;&lt;asp:Label ID="Label4" Text='&lt;%# Eval("Nachname") %&gt;' runat="server" /&gt;&lt;/td&gt;
                  &lt;td align="left"&gt;&lt;asp:Label ID="Label5" Text='&lt;%# Eval("Telefon") %&gt;' runat="server" /&gt;&lt;/td&gt;
  
               &lt;td align="left"&gt;&lt;asp:LinkButton runat="server" Text="Anzeigen" CommandName="Anzeigen" OnCommand="ListView1_ItemCommand" CommandArgument="myArguments"&gt;&lt;/asp:LinkButton&gt;&lt;/td&gt;
  
              &lt;/tr&gt;
  
          &lt;/ItemTemplate&gt;
  
  ...
  </code></pre>
  
  <p>cs file:</p>
  
  <pre><code>...
  
  protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
          {
              if (e.CommandName == "Anzeigen")
              {
                  Label lbText = (Label)e.Item.FindControl("Label2");
  
                 string email = lbText.Text;
  
                 Session["email"] = email;
  
                 Response.Redirect("Benutzer.aspx");
  
              }
          }
  
  ...
  </code></pre>
  
  <p>What is the matter :( </p>
  
  <p>tarasov</p>