Event registered in aspx
<asp:Repeater ID="StepRepeater" OnItemDataBound="StepRepeater_ItemDataBound1" runat="server">
Tried with AutoEventWireUp true & false
Here’s the method in the code behind:
public void LoadSteps(Request request)
{
Repeater StepRepeater = new Repeater();
StepRepeater.DataSource = request.Steps;
StepRepeater.DataBind();
}
protected void StepRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
}
When stepping through, it just goes straight through “StepRepeater.DataBind();” without hitting the ItemDataBound event.
Please let me know if any additional information would help.
Your
OnItemDataBoundvalue doesn’t match your method name.Remove
1from the end ofOnItemDataBoundor change your method name.Also as @Adil has stated, remove the
new Repeater()line:UPDATE: After reading your comment on another answer regarding adding the
new Repeater()line to prevent a null reference error:Adding
new Repeater()is going to create a new instance of aRepeatercontrol, therefore not referencing theRepeateron your ASPX markup file.If you are receiving a null reference exception, you should check that your
Inheritsproperty in your@Pagedirective (usually the very top line of your ASPX file) matches theclassin your.aspx.csfile, and that yourCodeFileproperty matches your.aspx.csfilename.