Add Events to Controls Nested in a Repeater ASP-C#
<p>I'm currently working with a repeater which has some number of drop down lists in it determined by how many items are databound to it. I wanted to add an event to each of these drop down lists in the scenario that a user changes the selected index. </p>

<p>Here is what I have for the repeater (Note that I am doing all of the databinding in the codebhind.):
        
            
                
            </p>

<pre><code>        &lt;ItemTemplate&gt;
            &lt;tr&gt;
                &lt;td&gt;
                    &lt;asp:DropDownList ID="DropDownList1" runat="server" Text='&lt;%# Eval("Data") %&gt;' AutoPostBack="True" OnTextChanged="TextChanged"&gt;
                        &lt;asp:ListItem&gt;Hello World&lt;/asp:ListItem&gt;
                        &lt;asp:ListItem&gt;GoodBye Cruel World&lt;/asp:ListItem&gt;
                    &lt;/asp:DropDownList&gt;
                &lt;/td&gt;
            &lt;/tr&gt;
        &lt;/ItemTemplate&gt;

        &lt;FooterTemplate&gt;
            &lt;/table&gt;
        &lt;/FooterTemplate&gt;
    &lt;/asp:Repeater&gt;
</code></pre>

<p>I am setting the OnTextChanged event here, however I did some experimenting with using the different events. I found that my method will not run when I am using the OnTextChanged or OnSelectedIndexChanged events. However, if I use some other events like OnLoad or OnPreRender, the method I have it set to actually runs.</p>

<p>So in short, why is it that when I put this drop down list in the repeater only SOME of the events seem to work?</p>
