Repeater Control Problem...

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
 
Z

Z D

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
 
Z

Z D

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:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top