ajax polling system

Last post 07-24-2008 3:07 AM by Vince Xu - MSFT. 4 replies.

Sort Posts:

  • ajax polling system

    07-22-2008, 2:52 AM
    • Loading...
    • melvinc
    • Joined on 06-18-2008, 3:16 PM
    • Posts 20
    i have been finding online tutorials about ajax polling system yet no results. does anyone teach me how to do ajax polling system using asp.net vb codes?
  • Re: ajax polling system

    07-22-2008, 9:00 AM
    Answer
    Darrell Norton, MVP
    Darrell Norton's Blog


    Please mark this post as answered if it helped you!
  • Re: ajax polling system

    07-22-2008, 11:24 AM
    Answer
    • Loading...
    • gt1329a
    • Joined on 06-23-2002, 8:53 PM
    • Atlanta
    • Posts 1,706
    Do you mean polling, as in a poll users can vote in, or polling the server for updates?  If the latter, here is an example of using setTimeout, page methods, and __doPostBack to implement lightweight polling.
  • Re: ajax polling system

    07-23-2008, 10:23 PM
    • Loading...
    • melvinc
    • Joined on 06-18-2008, 3:16 PM
    • Posts 20
    yupsas in a poll users can vote in.
  • Re: ajax polling system

    07-24-2008, 3:07 AM
    Answer

    Hi,

    You can try the below sample with Ajax Timer.

        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" >
            <ContentTemplate>
                <asp:Timer ID="Timer1" runat="server" Interval="3000" ontick="Timer1_Tick">
                </asp:Timer>
                The server counter is:<asp:Label ID="Label1" runat="server" Text="0"></asp:Label>           
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" >
            <ContentTemplate>
                 <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />           
            </ContentTemplate>
        </asp:UpdatePanel>
      
        protected void Timer1_Tick(object sender, EventArgs e)
        {
            if (Application["polling"] == null)
                Application["polling"] = 0;
            Label1.Text = Application["polling"].ToString();
    
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (Application["polling"] == null)
                Application["polling"] = 0;
            Application["polling"] = int.Parse(Application["polling"].ToString())+1;
        }

     You can also store the counter into the database.

    The below links are about polling system.

    http://www.scriptlance.com/projects/1215631785.shtml

    http://www.dhtmlgoodies.com/index.html?whichScript=ajax-poller

     

    Sincerely,
    Vince Xu
    Microsoft Online Community Support
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
    Answer” if a marked post does not actually answer your question.
Page 1 of 1 (5 items)
Microsoft Communities
Page view counter