Find Control In Datalist
<p>When I tried To Find Control n data List As I Mentioned Below</p>

<pre><code> Error(Object reference not set to an instance of an object.
</code></pre>

<p>I cannot know  </p>

<pre><code>protected void dlCategory_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        Label Lb = (Label)e.Item.FindControl("LblCat");
        Lb.ForeColor = System.Drawing.Color.Red;
    }



&lt;Datalist&gt;
 &lt;asp:DataList ID="dlSubCategory" runat="server" 
                                    DataSource='&lt;%# GetSubCategory(Convert.ToString(Eval("Category_ID")))%&gt;' 
                                    onitemcreated="dlSubCategory_ItemCreated" 
                                    onitemdatabound="dlSubCategory_ItemDataBound"&gt;
                                    &lt;EditItemStyle ForeColor="#CC3300" /&gt;
                                    &lt;SelectedItemStyle ForeColor="#CC3300" /&gt;
                                    &lt;ItemTemplate&gt;
                                        &lt;div class="buttn_div_sub"&gt;
                                            &lt;div class="lm40 tm2 buttn_txt"&gt;
                                                &lt;a href='&lt;%# Convert.ToString(Eval("ProductCategory_Id")).Insert(0,"ListView.aspx?ProductCategory_Id=") %&gt;'
                                                    class="buttn_txt"&gt;
                                                    &lt;asp:Label ID="Label1" runat="server" Text='&lt;%#DataBinder.Eval(Container.DataItem,"Name") %&gt;'&gt;&lt;/asp:Label&gt;
                                                &lt;/a&gt;
                                            &lt;/div&gt;
                                        &lt;/div&gt;
                                    &lt;/ItemTemplate&gt;
                                &lt;/asp:DataList&gt;
                            &lt;/ItemTemplate&gt;
</code></pre>
