I have a repeater and and and I set its DataSourceID
.
<asp:Repeater ID="rpProducts" runat="server" DataSourceID="ItemDataSource" >
<HeaderTemplate>....</HeaderTemplate>
<ItemTemplate>
....
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>
But I some time I want to change the DataSourceID
and load data and again set the ItemDataSource
.
This is my code for change the rpProducts DataSourceID
.
rpProducts.DataSourceID = null;
rpProducts.DataSource = goods;
rpProducts.DataBind();
So then again I want to set the DataSourceID
to ItemDataSource
.
How can I do it?
I try like this. but is not working
rpProducts.DataSourceID = null;
rpProducts.DataSourceID = ItemDataSource.ToString();