Re: ItemDataBound not Firing on Repeater
brian zinn <[email protected]> Fri, 7 Sep 2007 16:29:35 +0200
| Newsgroups | gmane.comp.windows.devel.dotnet.web |
|---|---|
| Message-ID | <[email protected]> |
Brady, Some of your code is missing, but is it possible that you are calling the databind when the page is post back? In that case your events won't be firing. Sorry if that's too obvious, but you're not showing where you do your binding. Cheers, Brian On 9/7/07, Brady Kelly <[email protected]> wrote: > Thanks Efran, > > The Page_Load event does fire, assigning the handler to the event without > complaint. The event just doesn't fire when I call DataBind later. > > > public DataTable DataSource > { > set > { > pagingManager.MaxPageSize = 15; > pagingManager.PaginateDataTable(value); > rptPageButtons.DataSource = pagingManager.PagesDataTable; > } > } > > public new void DataBind() > { > rptPageButtons.DataBind(); > } > > > > -----Original Message----- > > From: Discussion of building .NET applications targeted for the Web > > [mailto:[email protected]] On Behalf Of Efran Cobisi > > Sent: 07 September 2007 09:31 AM > > To: [email protected] > > Subject: Re: [DOTNET-WEB] ItemDataBound not Firing on Repeater > > > > 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 DevelopMentorR http://www.develop.com > > > > > > View archives and manage your subscription(s) at > > http://discuss.develop.com > > > > > > > =================================== > > This list is hosted by DevelopMentorR http://www.develop.com > > > > View archives and manage your subscription(s) at > > http://discuss.develop.com > > =================================== > This list is hosted by DevelopMentor(r) 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