Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7047377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:45:50+00:00 2026-05-28T02:45:50+00:00

I have a ajax Timer control. It adds + to the text value of

  • 0

I have a ajax Timer control. It adds “+” to the text value of a label. This timer should work only five times with an interval of “1000” – i.e, only five “+” should be available. After that, the lblPostbackType
Should be updated with the count. How do I achieve it?

public partial class _Default : System.Web.UI.Page
{
static int partialPostBackCount = 0;
protected void Page_Load(object sender, EventArgs e)
{
    if (IsPostBack)
    {
        if (ScriptManager.GetCurrent(this).IsInAsyncPostBack)
        {
           partialPostBackCount = partialPostBackCount + 1;
           lblPostbackType.Text = "Partial Postback:: " + partialPostBackCount.ToString();
        }
        else
        {
            lblPostbackType.Text = "Full Postback";
        }
    }

}
protected void Timer1_Tick(object sender, EventArgs e)
{
    Label1.Text = Label1.Text + "+";
}
}

And the designer code is

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:Timer runat="server" ID="Timer1" Interval="1000" OnTick="Timer1_Tick" />

 <asp:Label runat="server" ID="lblPostbackType" >SAMPLE</asp:Label>

<asp:UpdatePanel runat="server" ID="TimePanel" UpdateMode="Conditional">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
    </Triggers>
    <ContentTemplate>
        <asp:Label runat="server" ID="Label1" />
    </ContentTemplate>
</asp:UpdatePanel>

</form>

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:45:51+00:00Added an answer on May 28, 2026 at 2:45 am

    try this

    protected void Timer1_Tick(object sender, EventArgs e)
    {
    
    
        if (partialPostBackCount > 5 )
            {
               lblPostbackType.Text = "Partial Postback:: " + 
                                       partialPostBackCount.ToString();
               //Timer1.Enabled = false; //if you don't want it to continue
            }
            else
            {
                partialPostBackCount = partialPostBackCount + 1;
                Label1.Text = Label1.Text + "+";
            }
    
    }
    

    *static variables are not recommended..

    keep the Page_Load event method clean..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application and I'm attempting to put an ajax timer control
I have five DropDownList s linked together with the CascadingDropDown AJAX control. When it's
I have gridview with ajax rating control where i am updating rating value on
I have some AJAX work that brings across an additional form element that I
I have an ajax toolkit TabContainer control on my page with a couple tabs.
I have a jQuery question: I have an ADD button that adds text to
I have an AJAX-enabled SharePoint 2007 site. I have also created a user control
I have an Ajax control that is loaded into a Yahoo popup using jQuery.
I have successfully downloaded and installed AJAX framework, and the control toolkit. While trying
I have embedded the fullcalendar jquery control by using this code: $(document).ready(function() { var

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.