Pass an ID on button click
<p>I have this code below that create rows and cells for a list of products. There is a button that I want to use to get additional product information. Basically the user will search for something and it will display limited results. When the user clicks on the button it will call a method that will do something else. </p>

<p>How do I get that button to pass and ID or something to a method? </p>

<p>I tried the <code>.Click</code> but did not work to call the method. Currently the method only displays a messagebox.</p>

<pre><code>for (rowCtr = 1; rowCtr &lt;= rowCnt; rowCtr++)
{
    // Create new row and add it to the table.
    TableRow tRow = new TableRow();
    Table1.Rows.Add(tRow);
    for (cellCtr = 1; cellCtr &lt;= cellCnt; cellCtr++)
    {
        // Create a new cell and add it to the row.
        TableCell tCell = new TableCell();

        if (rowCtr == 1 &amp;&amp; cellCtr == 1)
        {
            Image ProductImage = new Image();
            ProductImage.Height = 75;
            ProductImage.Width = 75;
            tCell.RowSpan = 5;
            tCell.Controls.Add(ProductImage);
            tRow.Cells.Add(tCell);
        }

        if (rowCtr == 1 &amp;&amp; cellCtr == 2)
        {
            tCell.Text = "Title: Title of Product";
            tRow.Cells.Add(tCell);
        }

        if (rowCtr == 2 &amp;&amp; cellCtr == 2)
        {
            tCell.Text = "Weight (lbs): 54";
            tRow.Cells.Add(tCell);
        }

        if (rowCtr == 4 &amp;&amp; cellCtr == 2)
        {
            Button getOfferButton = new Button();
            getOfferButton.Width = 100;
            getOfferButton.Text = "Get Offer";
            getOfferButton.Click += new EventHandler(getOffer);
            tCell.Controls.Add(getOfferButton);

            tRow.Cells.Add(tCell);
        }

    }
}
</code></pre>
