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

3 posts, 1 answers
  1. T. Stanley
    T. Stanley avatar
    22 posts
    Member since:
    Sep 2007

    Posted 01 Jul 2012 Link to this post

    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. Answer
    Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 04 Jul 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. T. Stanley
    T. Stanley avatar
    22 posts
    Member since:
    Sep 2007

    Posted 12 Jul 2012 Link to this post

    Thanks!  This helped a lot!

Back to Top