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

update of usercontrol loaded in RadPageView to rebind the associated RadTabStrip?

2 Answers 174 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
T. Stanley
Top achievements
Rank 1
T. Stanley asked on 02 Jul 2012, 02:43 AM
Hi.

I have a page with several RadTabStrip/RadMultiPage combinations.  One of them dynamically loads copies of the same user control (with a parameter from the value of its RadTab) into correlating RadPageViews.  I have a 'Delete' button on the contained usercontrol that deletes its specific data.  So, then the whole RadTabStrip and PageViews needs to be rebound to reflect the change (which will have one less tab/pageview after the delete).  I can do this easily by simply reloading the whole page, but I would like to be more elegant, and do that with ajax.  How can a button event on a single PageView's usercontrol locate the containing RadTabStrip, and initiate a rebind via ajax?

Thanks for any help!!

Tom Stanley

2 Answers, 1 is accepted

Sort by
0
Accepted
Nencho
Telerik team
answered on 04 Jul 2012, 03:00 PM
Hello Thomas,

Here is what you could do to achieve the desired functionality. In the UserControl you could locate the RadTabStrip control. Thus you could easily associate the button with the aforementioned RadTabStrip control in a manner to ajaxify them. Please consider the following approach:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Web.UI;
 
public partial class Control1 : UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RadAjaxManager AjaxManager = RadAjaxManager.GetCurrent(Page);
        var tabstrip = this.NamingContainer.FindControl("RadTabStrip1") as RadTabStrip;
        AjaxManager.AjaxSettings.AddAjaxSetting(button, tabstrip);
    }
    protected void Button_OnClick(object sender, EventArgs e)
    {
        var tabstrip = this.NamingContainer.FindControl("RadTabStrip1") as RadTabStrip;
 
        //rebinding data
        tabstrip.DataSource = new string[] { "10", "20", "30" };
        tabstrip.DataBind();
 
    }
}

Here you could find more information on how to use the RadAjaxManager in scenarios like yours.

Greetings,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
T. Stanley
Top achievements
Rank 1
answered on 12 Jul 2012, 06:07 PM
Thanks!  This helped a lot!

Tags
TabStrip
Asked by
T. Stanley
Top achievements
Rank 1
Answers by
Nencho
Telerik team
T. Stanley
Top achievements
Rank 1
Share this question
or