What is the correct Condition (IF...THEN) with Data Repeater ?

  • Thread starter Thread starter kelvinweb
  • Start date Start date
K

kelvinweb

Hi All,

My Source Code is the following
<ItemTemplate>
<tr>
<td width="100" align="right"><font size="2" face="Verdana, Arial,
Helvetica, sans-serif">&nbsp;</font></td>
<%IF #Container.DataItem("LINE53")<>2 THEN%>
<td width="300" colspan="3"><font size="2" face="Verdana, Arial,
Helvetica,
sans-serif"><b>Line&nbsp;<%#Container.DataItem("LINE53")%></b></font></td>
<%END IF%>
</tr>
</ItemTemplate>

I got the error:
Compiler Error Message: BC30201: Expression expected.

Not uses '#'
Compiler Error Message: BC30451: Name 'Container' is not declared.

Please Help.
 
No, you don't do it in this way. You should handle ItemDataBound event to
check the values in the data items and set the visual properties of your
template elements.

Eliyahu
 
Hi Eliyahu,

I don;t understand. If I want to making condition case in ItemTemplate.
How to handle it ?
Any exmples ? Urgent. Thanks
 
My point is that you don't make condition cases in ItemTemplate. You handle
conditions in the code.

For example, this would be a fragment of your DataItemBound event handler:

if (e.Item.DataItem as <type cast to your datasource item>)["LINE53"] <> 2)
runCodeThatWillSetTheTemplateForThisCondition();

Eliyahu
 

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

Back
Top