Click here to Skip to main content
15,922,894 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Design:
C#
<asp:ScriptManager runat="server">
</asp:ScriptManager>


XML
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
               <ContentTemplate>
                   <asp:Label ID="Label1" runat="server" Text="Label" Font-Bold="True" Font-Size="120pt" ForeColor="#CC0000"></asp:Label>
                   <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None">
                       <AlternatingRowStyle BackColor="White" />
                       <Columns>
                           <asp:TemplateField HeaderText="Title">
                               <ItemTemplate>
                                   <%#Eval("Title")%>
                               </ItemTemplate>
                           </asp:TemplateField>
                       </Columns>
                       <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                       <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                       <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                       <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                       <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                       <SortedAscendingCellStyle BackColor="#FDF5AC" />
                       <SortedAscendingHeaderStyle BackColor="#4D0000" />
                       <SortedDescendingCellStyle BackColor="#FCF6C0" />
                       <SortedDescendingHeaderStyle BackColor="#820000" />
                   </asp:GridView>
               </ContentTemplate>
               <Triggers>
                   <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
               </Triggers>
           </asp:UpdatePanel>


Code:
C#
using System;
using System.Web.UI;
using VOV.Data;
namespace Axjax_Update_data_Alway
{
    public partial class _Default : Page
    {
        DataArticle da = new DataArticle();
        private int i = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            UpdateDataBase();
        }
         void UpdateDataBase()
        {

           GridView1.DataSource = da.GetAllArticles();
             GridView1.DataBind();

        }

        protected void Timer1_Tick(object sender, EventArgs e)
        {
            UpdateDataBase();
            Label1.Text = DateTime.Now.ToString("HH:mm:ss");

        }
    }
}

Question.
I want it always running. When data changes in sql it on websites and instant change. I have done but it is very heavy. I need to always update in 0.1 seconds. What do I do? Help me.
Posted
Comments
Thanks7872 7-Nov-13 23:06pm    
Update on 0.1 sec? Are you sure? Then actually you will see nothing (you will not identify the updates) since its very small amount of time. Elaborate if i misinterpreted.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900