Hi there.
I have a question I have wanted to ask for a while now...
I have a Repeater with 2 DropDownLists. 1 is for a List of Expressions. 1 is for a List of Rules.
They are both bound to 2 different ObjectDataSource's. Basically as the Repeater iterates I want to display 1 or the other.
The problem is both are always bound, even when I make them visible or not.
Is there a good way to do this or is the Repeater the wrong Control to be using?
Here is the code I am using:
<table border="0" cellpadding="3">
<asp:Repeater ID="rptExpressions" runat="server" DataSourceID="AddExpressionList" EnableViewState="true" >
<ItemTemplate>
<asp:Panel ID="panExpression" runat="server" Visible='<%# Eval("ExpressionType").ToString() == "Expression" %>'>
<tr>
<td>
<asp:LinkButton ID="butRemove" runat="server" Text="Remove" OnClick="RemoveExpression_Click" CommandArgument='<%# Container.ItemIndex %>' />
</td>
<td>
<asp:DropDownList ID="drpVariableList" runat="server" AutoPostBack="true"
DataSourceID="VariableList" DataTextField="Name"
OnSelectedIndexChanged="VariableChanged_Selected" OnDataBound="Variable_Created"
Text='<%# Eval("SelectedVariable") %>' Width="200" />
</td>
<td>
<asp:DropDownList ID="drpOperatorList" runat="server" Width="140" />
</td>
<td>
<asp:TextBox ID="txtValue" runat="server" Text='<%# Eval("SelectedValue") %>' />
</td>
</tr>
</asp:Panel>
<asp:Panel ID="panRules" runat="server" Visible='<%# Eval("ExpressionType").ToString() == "Rule" %>'>
<tr>
<td>
<asp:LinkButton ID="LinkButton1" runat="server" Text="Remove" OnClick="RemoveExpression_Click" CommandArgument='<%# Container.ItemIndex %>' />
</td>
<td>
<asp:DropDownList ID="drpRuleList" runat="server" OnDataBound="Rule_Created"
DataSourceID="RuleList" DataTextField="Name"
Width="200" />
</td>
<td>
<asp:DropDownList ID="drpRuleValue" runat="server" Width="140">
<asp:ListItem Text="True" />
<asp:ListItem Text="False" />
</asp:DropDownList>
</td>
<td>
</td>
</tr>
</asp:Panel>
</ItemTemplate>
</asp:Repeater>
</table>