I have a DisplayItem.aspx page. I have added a "ScriptManager" control and an "Update Panel" control to this page. Now, add a "Repeater" and a "Timer" control to the Update panel. Configure the "Repeater" to use a SqlDataSource as it's datasource.
In the select command, I have selected the Top 20 Product IDs and their names from the [Product] table in SQL Server 2005 "AdventureWorks" database.
Add a Header template for the two columns we are binding to in the repeater. And add Two label controls inside the ItemTemplate section for the actual data items.
Next, I have added an event handler for the Timer's OnTick event and specified 5 seconds as the Timer interval.
Now, add a "AsyncPostBackTrigger" to the Triggers collection of the update panel. Give the ID of the Timer control in the 'ControlID' property and use "Tick" for the EventName.
<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>
<div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
<HeaderTemplate>
<table>
<tr>
<td>ProductID</td>
<td>Product Name</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table>
<tr>
<td>
<%
Join the conversation! Your thoughts help the community grow.