I had a problem recently in which I had to update the time automatically without refreshing the page. I found the most simple solution which is as follows.
Place your grid view inside an update panel like this:
Before closing the
Place your grid view inside an update panel like this:
Code:
<asp:UpdatePanel ID="pnltoday" runat="server">
<ContentTemplate>
<asp:GridView ID="myGrid" runat="server" />
<Columns>
//All your template fields or bound fields go here....
</Columns>
</asp:GridView>
<asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick">
</asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
</contentTemplate > tag, place an ASP.NET timer control and now in the code behind file, in the Timer1_Tick event call your method to bind the GridView like:Code:
protected void Timer1_Tick(object sender, EventArgs e)
{
myGrid.DataSource="Your Function";
myGrid.DataBind();
}
Comment