how to retrieve TextBox control's ClientID within the ListView's ItemDataBound event?
<p>I am having trouble retrieving a TextBox control's ClientID value from a ListView control.
I thought this syntax would return me the ClientID fine(very strange):
<strong>((TextBox)e.Item.FindControl("amount")).ClientID;</strong></p>

<p>but it keeps throwing this exception:</p>

<p><strong>"Index was out of range. Must be non-negative and less than the size of the collection.
 Parameter name: index"</strong></p>

<p>Any help is greatly appreciated.
Below is my code:
aspx:</p>

<pre><code>&lt;asp:ListView ID="categories" runat="server" 
    ClientIDRowSuffix="ID"
     ItemPlaceholderID="categoryItem"
     DataKeyNames="ID" onitemdatabound="categories_ItemDataBound"&gt;
    &lt;ItemTemplate&gt;             
            &lt;div class="category"&gt;
                &lt;asp:TextBox ID="amount" runat="server" /&gt;                   
            &lt;/div&gt;
     &lt;/ItemTemplate&gt;

&lt;/asp:ListView&gt;
</code></pre>

<p>codebehind:</p>

<pre><code>public string AmountTextBoxClientID { get; set; }

    protected string GetAmountTextBoxClientID()
     {
         return this.AmountTextBoxClientID;
     }


protected void categories_ItemDataBound(object sender, ListViewItemEventArgs e)
     {
         switch (e.Item.ItemType)
         {
             case ListViewItemType.DataItem:

                TextBox amountTextBox = (TextBox)e.Item.FindControl("amount");//this line excutes without any error
                 amountTextBox.Text = categoryAmount.ToString("C");
                 amountTextBox.Attributes.Add("readonly", "readonly");

                this.AmountTextBoxClientID = amountTextBox.ClientID; //this line keeps throwing the OutOfRange exception
                 break;
         }

    }
</code></pre>
