I find that I have a repeater control that binds to an XML document. My client now requests that the text field that is the repeater can be either a text box or a check box.
I cannot find an easy way to do the following:
if ((System.Xml.XmlNode)e.Item.DataItem.Attributes["type"] == "text")
<asp:TextBox runat="server" ID="txtField" Text='<%#((System.Xml.XmlNode)Container.DataItem).InnerText %>' CssClass="std"></asp:TextBox>
else
<asp:CheckBox runat="server" ID="txtField" Text='<%#((System.Xml.XmlNode)Container.DataItem).InnerText %>' CssClass="std"></asp:TextBox>
Is there a good way to extend the current implementation without rewriting the logic. If I could insert a control through "OnItemDataBound", that would also be right. But I can’t make it work.
source
share