Repeater Control Problem...

  • Thread starter Thread starter Z D
  • Start date Start date
Z

Z D

Hello,

I'm using a repeater control and I wish to put some logic in when accessing
one of the columns.

If I use this syntax, I'm able to output the column with no problem:
<%# (Container.DataItem("Quantity")) %>


But now I wish to put some logic around this, so, first I tried the
following:
<% Response.Write(Container.DataItem("HomeProfileNrgEquipQtyElectric")) %>

This gives the following error:
BC30451: Name 'Container' is not declared.



Does anybody have any idea what I'm doing wrong? Eventually, instead of
using the Response.Write, I'll be putting an IF statement in there. Why
cant I access the "container" in this fashion?

I'm assuming it's just my syntax.... ?


Thanks in advance :)
-ZD
 
Sorry, the second peice of code should have been:
<% Response.Write(Container.DataItem("Quantity")) %>

I still get the same error, it was just a typo in my original post. Any
thoughts?

-ZD
 
Hi Bin,

Thaks for your reply.

I'm not sure that I can put the code in the ItemDataBound event because I
need to output (response.write) some HTML on the .aspx page at exactly a
certain spot depending on the value of a specific data item.

Is this possible?

thanks!
-ZD

Bin Song said:
Hi,

<%#Container.DataItem ...%> is only for simple data binding. If you want
to include some logic, write the code in the Repeater.ItemDataBound Event.
Please see:
 
Back
Top