Container.DataItemIndex not working inside of gridview
<p>For some reason in my code container.DateItemIndex is not returning any value in my code. </p>

<p>Here is my asp.net: </p>

<pre><code>   &lt;asp:Label ID="Label1" runat="server" Text=""&gt;&lt;/asp:Label&gt;

&lt;form id="form1" runat="server"&gt; 
         &lt;asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
             AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="SqlDataSource1" 
             EnableModelValidation="True" onrowcommand="GridView1_RowCommand" OnRowUpdating="GridView1_RowUpdating" &gt;

             &lt;Columns&gt;
                 &lt;asp:CommandField ShowEditButton="True" ControlStyle-CssClass="savefile"/&gt;
                 &lt;asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                     ReadOnly="True" SortExpression="ID" /&gt;
                 &lt;asp:BoundField DataField="event_name" HeaderText="event_name" 
                     SortExpression="event_name" /&gt;

                 &lt;asp:TemplateField HeaderText="PDF"&gt;

           &lt;ItemTemplate&gt;

               &lt;asp:Button ID="Button1" CommandArgument='&lt;%# Container.DataItemIndex %&gt;' CommandName="DownloadFile" runat="server" Text="Button" /&gt;

            &lt;/ItemTemplate&gt;

           &lt;EditItemTemplate&gt;

               &lt;asp:FileUpload ID="FileUpload1" runat="server" /&gt; // shown only in edit mode

           &lt;/EditItemTemplate&gt;

          &lt;/asp:TemplateField&gt;

             &lt;/Columns&gt;
         &lt;/asp:GridView&gt;
&lt;/form&gt;
</code></pre>

<p>and my C# code: </p>

<pre><code>protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {

    if (e.CommandName == "DownloadFile")
    {

        Label1.Text = e.CommandArgument.ToString();

    }

}
</code></pre>

<p>Why am i not getting any values from the  CommandArgument='&lt;%# Container.DataItemIndex %>'</p>
