if condition depending on DataBinder

T

Theodor Ramisch

Hi there,

i got a Repeater control which repeats through some rows and should
display
a WebControl depending on a value of the row:

It should be something like that:

<asp:Repeater ID="Filters" runat="server" DataSource="<%#obj.arr%>">
<ItemTemplate>
<% if(DataBinder.Eval(Container,"DataItem.type"))=="TEXT") { %>
<asp:textbox runat="server" />
<% } else { %>
<asp:calender runat="server" />
<% } %>
</ItemTemplate>
</asp:Repeater>

But this, of course, doesn't work because the Container is only avaiable
in <%# but not for <%. Is there any solution to realize this? I can't
use
just the CodeBehind to create the controls because the controls must be
colored and skinned by HTML-Only-dont-want-to-look-in-cs-files
Designers...


Best regards,

Theodor
 
E

Eliyahu Goldin

Theodor,

Let your designers design as they wish. You can manipulate Enabled property
to show/hide right controls. Put both controls into the ItemTemplate and
databind Enabled to proper condition, Or set it in code-behind in
ItemDataBound event. The HTML designers still won't have to do anything in
code-behind.

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

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top