Assign an event to a custom control inside a Repeater control

后端 未结 3 614
野的像风
野的像风 2020-12-11 11:10

I have a Repeater control which in some of its cells contains a UserControl which contains a DropDownList. On the ItemDataBound event of the Repeater control I\'m assigning

3条回答
  •  孤城傲影
    2020-12-11 11:46

    There are two things you can try to see if it will help:

    1. Try binding your MyRepeater on every page request, not just when !IsPostBack.
    2. Bind MyRepeater inside OnInit.

    For 1) If your dynamically created controls are created the first time the page loads and then again when postback occurs, ASP.NET will notice that the event raised matches and will fire the event.

    For 2) The designer used always place event attachment in OnInit, though it should work fine in OnLoad too.

提交回复
热议问题