How to pass parameter through button click
<p>I have a gridview with a databinding : all rows are generated depending on ItemSource. I have also add a column at the end containing a button. How to bind a field from current itemSource, as a parameter of button click event?</p>

<p>Here is code sample :</p>

<p><strong>WEBFORM</strong></p>

<pre><code>&lt;asp:GridView ID="GridView1" runat="server" 
    AutoGenerateColumns="false" 
    ItemType="ServiceMonitoring.MyClass" 
    SelectMethod="GetMyClassItems" 
    CellPadding="4" 
    ShowFooter="true"&gt;
    &lt;Columns&gt;
        &lt;asp:BoundField DataField="MyProperty" HeaderText="ID" /&gt;
        &lt;asp:TemplateField HeaderText="Action"&gt;
            &lt;ItemTemplate&gt;
                &lt;asp:Button runat="server" 
                    CommandArgument='&lt;%= MyClass.MyProperty %&gt;' 
                    CommandName="ThisBtnClick" 
                    OnClick="Unnamed_Click" 
                    Text="retraiter !" /&gt;
                &lt;%--&lt;button onclick="UpdateMyClassItems" runat="server" value="VALEUR"&gt;retraiter !&lt;/button&gt;--%&gt;
            &lt;/ItemTemplate&gt;
        &lt;/asp:TemplateField&gt;
    &lt;/Columns&gt;
&lt;/asp:GridView&gt;
</code></pre>

<p><strong>Code-behind</strong></p>

<pre><code>public partial class WebForm1: System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e) { }

    public List&lt;MyClass&gt; GetMyClassItems()
    {
        var a = new MyClass() { MyProperty = 2 };
        return new List&lt;MyClass&gt;() { a };
    }

    protected void Unnamed_Click(object sender, EventArgs e)
    {
        var arg = (sender as Button).CommandArgument;
        string ID = arg.ToString();
    }
}

public class MyClass
{
    public int MyProperty { get; set; }
}
</code></pre>

<p>Command argument binding doesn't work. Can you help me please ?</p>