ASP GridView obtiene los valores de la fila al hacer clic en el botón

Lo que estoy haciendo - restablecer la contraseña del usuario en el botón de imagen haga clic.

Hecho hasta ahora - agregó GridViewCommandEventHandler - está disparando correctamente. Usando código deMSDN. Recibo una cadena vacía ("") para mi e.CommandArgument, y está generando un error cuando se ejecuta (no se puede analizar "" a int).

Puedo ver en el depurador que hay una propiedad 'rowIndex' almacenada (correctamente para mi clic) en otra parte de e, ¿puedo acceder a esto? Creo que el código de MSDN funcionaría: ¿hay algo más que haya hecho para que se produzca este error u otra forma de solucionarlo? Gracias.

<code>void resetpassword(Object sender, GridViewCommandEventArgs e)
{
    // If multiple ButtonField columns are used, use the
    // CommandName property to determine which button was clicked.
    if (e.CommandName == "resetpass")
    {
        // Convert the row index stored in the CommandArgument
        // property to an Integer.
        int index = Convert.ToInt32(e.CommandArgument);

        // Retrieve the row that contains the button clicked
        // by the user from the Rows collection. Use the
        // CommandSource property to access the GridView control.
        GridView GridView1 = (GridView)e.CommandSource;
        GridViewRow row = GridView1.Rows[index];

        String usrname = row.FindControl("username").ToString();
</code>

código de la página aspx:

<code><asp:TemplateField HeaderText="Reset Password">
                <ItemTemplate>
                    <asp:ImageButton ID="ibtnReset" runat="server" CausesValidation="false" 
                        CommandName="resetpass" ImageUrl="~/Images/glyphicons_044_keys.png" Text="Button" />
                </ItemTemplate>
                <HeaderStyle Width="70px" />
                <ItemStyle HorizontalAlign="Center" />
            </asp:TemplateField>
</code>

Evento agregar código:

<code> protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        GridView1.RowCommand += new GridViewCommandEventHandler(this.resetpassword);
    }
</code>

Respuestas a la pregunta(2)

Su respuesta a la pregunta