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

  • Home
  • SEARCH
  • 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 9016393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:59:03+00:00 2026-06-16T03:59:03+00:00

I use a Multiview to display some Charts. On first load, the page presents

  • 0

I use a Multiview to display some Charts. On first load, the page presents 2 drop downs and a GO button. I use the Code Behind to choose which View to display based on the selections from the dropdowns.

The page has an AJAX refresh with a Button that allows the user to stop auto-refreshing. The button disables the Timer, changes the button text, Italicises it and disables the button itself. This works great.

The user selects their options and hits GO and the requested View displays. I have not allowed for a way to turn on auto refresh. Purely out of ease for myself. I thought the easiest way would be to just allow the user to hit the GO button again (The selections governing the current View are still selected in the dropdowns) which would reload the View with the auto-refresh enabled by default.

Below is the essential code for what I currently have with just one view to demonstrate.

ASP.NET

<asp:Content ID="HeadContent" runat="server" ContentPlaceHolderID="HeadContent">
    <script type="text/javascript">
        function SetText(id) {
            if (id.value == "Disable automatic page refresh")
                id.value = "Processing Request ...";
        }
    </script>
</asp:Content>

<asp:DropDownList ID="itemDropdown" runat="server">
            ASP LIST ITEMS
</asp:DropDownList>
<asp:DropDownList ID="timeDropdown" runat="server">
            ASP LIST ITEMS
</asp:DropDownList>
<asp:Button ID="Button1" runat="server" Text="Go" OnClick="Button1_Click" />
</p>
<p>
    <asp:Label ID="errorLabel" runat="server" CssClass="errorLabel"></asp:Label>
</p>

<asp:MultiView ID="MultiView1" runat="server">
    <asp:View ID="View1" runat="server">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" ViewStateMode="Enabled" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:Button ID="Button2" runat="server" Text="Disable automatic page refresh" OnClick="Button2_Click" OnClientClick="return SetText(this)" /></p>
        CONTENT HERE
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
            </Triggers>
        </asp:UpdatePanel>
        <asp:Timer ID="Timer1" runat="server" Interval="60000">
        </asp:Timer>
    </asp:View>

CODE BEHIND

protected void Button1_Click(object sender, EventArgs e)
{    
    if (errorLabel.Text != null)
    {
        errorLabel.Text = string.Empty;
    }

    if (itemDropdown.SelectedValue == "5" && timeDropdown.SelectedValue == "0.5")
    {
        MultiView1.ActiveViewIndex = 0;
        UpdatePanel1.Update();
    }
    IF CONTINUES ...
    else
    {
        errorLabel.Text = "You did not choose a valid Item or Timeframe.  Please try again.";
    }
}

protected void Button2_Click(object sender, EventArgs e)
{
    Timer1.Enabled = false;
    Button2.Text = "Automatic Refresh Disabled";
    Button2.Font.Italic = true;
    Button2.Enabled = false;
}

My issue is that when I click the GO button, the updated button conditions are still in place. ie. The name is changed, italicized and disabled. Is there a way to force a View to completely reload? I hope this makes sense. I tried UpdatePanel1.Update(); as can be seen above in the Button1_Click method but it didn’t work.

Using Ann L’s suggestion, I tried the following but none would work:

protected void Button2_Click(object sender, EventArgs e)
{
    Timer1.Enabled = false;
    Button2.Text = "Automatic Refresh Disabled";
    Button2.Font.Italic = true;
    Button2.Enabled = false;

    Timer1.Enabled = true;
    Timer1.Interval = 10000;
    Button2.Text = "Disable automatic page refresh";
    Button2.Font.Italic = false;
    Button2.Enabled = true;
}

protected void Button2_Click(object sender, EventArgs e)
{
    Timer1.Enabled = true;
    Timer1.Interval = 10000;
    Button2.Text = "Disable automatic page refresh";
    Button2.Font.Italic = false;
    Button2.Enabled = true;     

    Timer1.Enabled = false;
    Button2.Text = "Automatic Refresh Disabled";
    Button2.Font.Italic = true;
    Button2.Enabled = false;
}

protected void Button2_Click(object sender, EventArgs e)
{
    if (!Button2.Enabled)
    {
        Timer1.Enabled = true;
        Timer1.Interval = 10000;
        Button2.Text = "Disable automatic page refresh";
        Button2.Font.Italic = false;
        Button2.Enabled = true;
    }
    else
    {
        Timer1.Enabled = false;
        Button2.Text = "Automatic Refresh Disabled";
        Button2.Font.Italic = true;
        Button2.Enabled = false;
        Button2.ToolTip = "Click again to resume automatic refresh";
    }
}

To solve this issue I put the following in to my Code Behind:

protected void Button2_Click(object sender, EventArgs e)
{
    if (Button2.Text == "Disable automatic page refresh")
    {
        Timer1.Enabled = false;
        Button2.Text = "Automatic Refresh Disabled";
        Button2.Font.Italic = true;
        Button2.ToolTip = "Click again to resume automatic refresh";
    }
    else
    {
        Timer1.Enabled = true;
        Timer1.Interval = 10000;
        Button2.Text = "Disable automatic page refresh";
        Button2.Font.Italic = false;
        Button2.ToolTip = "Click to disable automatic page refresh";
    }
}
  • 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-06-16T03:59:04+00:00Added an answer on June 16, 2026 at 3:59 am

    OK, assuming I understand what you’re asking (how to undo the changes made to Button2), here is how I would do it:

    The following code would go into Button1_Click:

    if(!Button2.Enabled)
    {
        Timer1.Enabled = true;  // You might also have to reset its properties
        Button2.Text = "Disable automatic refresh";
        Button2.Font.Italic = false;
        Button2.Enabled = true;
    }
    

    Updating an UpdatePanel has no effect if you haven’t changed the state of any controls. It’s not like refreshing an iframe or the whole page: it just re-renders the page, making changes visible. It doesn’t reset the values or properties of anything.

    I am not an UpdatePanel expert, but I think that adding this code to Button1_Click (that’s a full postback, yes?) should get you going again.

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

Sidebar

Related Questions

I'm trying to use a multiview control. I'm first creating some views and add
I use the below code to auto refresh the page every 60 seconds via
For a personnal page I use the MultiViews options in Apache to determine which
use Text::Table; my $tb = Text::Table->new(Planet,Radius\nkm,Density\ng/cm^3); $tb->load( [ Mercury,2360,3.7], [ Mercury,2360,3.7], [ Mercury,2360,3.7], );
Use of gradient images is very common among developers for styling a page. Gradient
I have an asp.net page with a multiview control nested within another multiview control.
Use case example: Client A comes to request sales information, enters their zip code
I have a multiview control which I effectively use the same as a wizard
Use case: we have some project meta-data files which we want tracked, but are
How to use MultiView as Tabs in Asp.net 2.0? Is there a good example

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.