How to remove RadTabStrip's tab image from javascript

2 posts, 0 answers
  1. Dev-OBA
    Dev-OBA avatar
    2 posts
    Member since:
    Jul 2011

    Posted 14 Oct Link to this post

    Hello Telerik support

    I have ImageUrl="../Images/loadingArrow.gif" set to RadTab in a RadTabstrip. After page load, ajax asynchronous request is executed and once it is successful, I want to remove the Image from the Tab. 

      <telerik:RadTab Text="Tab2" Value="Tab2" runat="server" PostBack="true" PageViewID="rpvTab2" CssClass="tab" SelectedCssClass="tabSelected" ImageUrl="Images/loadingArrow.gif"/>

    I used following code in javascript which did a trick, but after the postback the original image is displayed on the Tab.

      var listChildNodes = tab.get_element().getElementsByClassName("rtsIn")["0"].childNodes;
      tab.get_element().getElementsByClassName("rtsIn")["0"].removeChild(listChildNodes[0]);

     

    Can you please suggest a way to remove the Image from the Tab and also it should not be visible after postback.

     

    Thanks.

    Manisha

     

  2. Peter Milchev
    Admin
    Peter Milchev avatar
    135 posts

    Posted 19 Oct Link to this post

    Hello Manisha,

    My guess is that your are not using the trackChanges and commitChanges client-side methods as described in the Preserving changes section of the Client-side programming overview article. You could also review the following forum post:

     Change does not persist after a postback.

    Here is also a sample JavaScript code you could use to remove the icon of the RadTab and persist the changes after the postback:

    tabStrip.trackChanges();
    tab.set_imageUrl();
    tabStrip.commitChanges();

    Regards,
    Peter Milchev
    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top