Re: ItemDataBound not Firing on Repeater

Efran Cobisi <[email protected]> Fri, 7 Sep 2007 09:30:49 +0200
Newsgroups gmane.comp.windows.devel.dotnet.web
Organization cobisi.com
Message-ID <[email protected]>
Hi Brady,

You didn't show us where and when you are calling the DataBind() method.
If this happens before the Page_Load() method is called then the
ItemDataBound event handler cannot be called because it hasn't been
attached at that time yet. Also, can you check if the page has the
AutoEventWireup property set to true? If not, the Page_Load() method
would not be attached to the Load event for the page thus the
ItemDataBound event handler would never be attached for this page.

Hope this helps.

--
Efran Cobisi
http://www.cobisi.com

Brady Kelly wrote:
> I have a user control that comprises a Repeater that builds a vertical table
> of buttons.  In the Page_Load event of the user control I bind an event
> handler, but the event never fires.  My code is like this:
>
>
>
>         protected void Page_Load(object sender, EventArgs e)
>
>         {
>
>             rptPageButtons.ItemDataBound += new
> RepeaterItemEventHandler(rptPageButtons_ItemDataBound);
>
>         }
>
>
>
>         void rptPageButtons_ItemDataBound(object sender,
> RepeaterItemEventArgs e)
>
>         {
>
>             throw new Exception("The method or operation is not
> implemented.");
>
>         }
>
>
>
> However, if I use the OnItemDataBound attribute, the event fires.  Why could
> this be?
>
>
> ===================================
> This list is hosted by DevelopMentor®  http://www.develop.com
>
> View archives and manage your subscription(s) at http://discuss.develop.com
>

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com