I have a GridView that is bound to a SQL Data source. I have put this inside an Update panel and want the contents to update at a specified interval. The problem is that if i change the data in the database, the GridView does not update itself, i have to manually refresh the page to view the new data.
What else do I need to do to get a GridView to refresh itself?
<asp:Timer ID="RefreshTimer" runat="server" Interval="10000"
ontick="RefreshTimer_Tick">
</asp:Timer>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div id="quad1"><uc1:MyWidget ID="MyWidget1" runat="server" /></div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="RefreshTimer" EventName="Tick" />
</Triggers>
</asp:UpdatePanel>
You have to call gridView.DataBind() on tick event