RadButton w/ UpdateProgress

4 posts, 0 answers
  1. Mike
    Mike avatar
    41 posts
    Member since:
    Aug 2011

    Posted 31 Oct 2012 Link to this post

    I am looking for a way to use the ASP Update Progress component with a RadButton with an image. I'd like to have a static image and then a loading gif when clicked to give the user an indication that data processing is being done. Is there any relatively simple way to intergrate the RadButton and the Update Progress control?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 01 Nov 2012 Link to this post

    Hi Robert,

    Try the following code to achieve your scenario.

    ASPX:
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate>
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
        <telerik:RadButton ID="RadButton1" runat="server" AutoPostBack="true"
                    onclick="RadButton1_Click"></telerik:RadButton>
      </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server">
      <ProgressTemplate>
        <asp:Image ID="Image1" ImageUrl="url" runat="server" />
      </ProgressTemplate>
    </asp:UpdateProgress>

    C#:
    protected void RadButton1_Click(object sender, EventArgs e)
    {
      System.Threading.Thread.Sleep(3000);
      Label1.Text = "Page refreshed at " + DateTime.Now.ToString();    
    }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mike
    Mike avatar
    41 posts
    Member since:
    Aug 2011

    Posted 01 Nov 2012 Link to this post

    Not exactly what I'm looking for. What I am actually trying to accomplish is replacing the image in the RadButton with a loading animated gif. I can add a dummy RadButton with the animated button, however if I use that method, I need a way to hide the actual button while it is updating.
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 02 Nov 2012 Link to this post

    Hi Robert,

    You can set the visibility of RadButton as follows to achieve your scenario.

    ASPX:
    <script type="text/javascript">
    function OnClientClicked(sender, args)
    {
     sender.set_visible(false);
    }
    </script>

    C#:
    protected void RadButton1_Click(object sender, EventArgs e)
    {
     System.Threading.Thread.Sleep(3000);
     Label1.Text = "Page refreshed at " +
     DateTime.Now.ToString();
     RadButton1.Visible = true;
    }

    Hope this helps.

    Thanks,
    Princy.
Back to Top