Search code examples
vb.netdatagriditemtemplateservercontrols

How to set <ItemTemplate> to a datasource?


How can I set the datasource of an ItemTemplate? Right now I have one that is wrapped by a datarepeater and that is how I databind to it.

 <asp:Repeater ID="rptTotal" runat="server">
        <ItemTemplate>
            <tr>
                <td>One</td>
            <td>Two</td>
            <td>Three</td>
            <td>Four</td>
                </tr>
        </ItemTemplate>
</asp:Repeater>

Solution

  • You cant set the datasource for the item template, you can set it for the repeater in the code behind using

    rptTotal.DataSource = datasourcename