This is a migrated thread and some comments may be shown as answers.

Change does not persist after a postback

1 Answer 159 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
JC
Top achievements
Rank 1
JC asked on 26 Feb 2013, 02:43 AM
Hi,

There is a RadTabStrip control in my user home page and I want to add a new tab to it using Javascript. I am able to add a new tab but the issue is that the change is not persisting after some postback is made. Am I missing something to save the change? Please help.

Thanks,
JC.

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 26 Feb 2013, 05:13 AM
Hello JC,

I believe you are not using the trackChanges and commitChanges client side methods. Client side changes are available on the server side after postback but only changes to the tabs that occur between a call to trackChanges and commitChanges persist after a postback.

Please have a look at the following code which works fine at my end. I am adding tabs to RadTabStrip on clicking a RadButton using client side code.

ASPX:
<telerik:RadTabStrip ID="RadTabStrip1" runat="server" Skin="WebBlue">
    <Tabs>
        <telerik:RadTab runat="server" Text="Telerik">
        </telerik:RadTab>
        <telerik:RadTab runat="server" Text="ASP">
        </telerik:RadTab>
        <telerik:RadTab runat="server" Text="Ajax">
        </telerik:RadTab>
    </Tabs>
</telerik:RadTabStrip>
<telerik:RadButton ID="RadButton1" runat="server" Text="Add Tab" OnClientClicked="AddTab"></telerik:RadButton>

JavaScript:
<script type="text/javascript">
    function AddTab(sender, args) {
        var tabStrip = $find("<%= RadTabStrip1.ClientID %>");
        var tab = new Telerik.Web.UI.RadTab();
        tab.set_text("New Tab");
        tabStrip.trackChanges();
        tabStrip.get_tabs().add(tab);
        tabStrip.commitChanges();
    }
</script>

Thanks,
Princy.
Tags
TabStrip
Asked by
JC
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or