asp repeater

  • Thread starter Thread starter John Giblin
  • Start date Start date
J

John Giblin

I have an asp repeater control which I am trying to assign the
datasorce to it inline. Here is my code.

<asp:Repeater ID="AddOnList" DataSource="<%#
BasketLineDAO.GetByEventCategory(content.Id,10)%>" Runat=server>

This does not work. I do not get any rows from the repeater. but when
I assign the datasource and bind it in the behing code, I do get the
rows

Behind Code:
// AddOn basket
AddOnList.DataSource = BasketLineDAO.GetByEventCategory(content.Id,
10);
AddOnList.DataBind();

This is driving me nuts!



John
 
When you assign the data source declaratively inline, do you still call
DataBind? You need to call it.
 
AddOnList.DataBind();

as you did when assigning the datasource programmatically. With exactly same
idea to get control to bind to the datasource.
 
Oh I am sorry, I am doing it in line of the control. I can do it
programmatically, but I do want ot do it this way.

ie
<asp:repeater id="AddOnList" runat="server"
DataSource='<%#ProductDAO.GetByCategoryId(
(int)(DataBinder.Eval(Container.DataItem,"Id")) ) %>'>
 
Back
Top