Ajax refresh only depended control on apply filter

3 posts, 1 answers
  1. Jonny
    Jonny avatar
    5 posts
    Member since:
    Apr 2010

    Posted 19 Jun 2010 Link to this post

    Hi, I'am constructing filter expression directly, not using FilterContainerID. I have RadTreeView, which must be ajax refreshed, when user click apply button in filter. I use next code to support ajax refresh filter, when user edit filter expression:
    <rad:RadAjaxManagerProxy ID="AjaxManagerProxy" runat="server">  
        <AjaxSettings> 
            <rad:AjaxSetting AjaxControlID="Filter">  
                <UpdatedControls> 
                    <rad:AjaxUpdatedControl ControlID="Filter" LoadingPanelID="LoadingPanel"/>  
                </UpdatedControls> 
           </rad:AjaxSetting> 
        </AjaxSettings> 
    </rad:RadAjaxManagerProxy> 
    Next code refresh RadTreeView on each user filter edit operation, this wrong. I need refresh only RadTreeView(not full page with other controls) on apply button click:
    <rad:RadAjaxManagerProxy ID="AjaxManagerProxy" runat="server">  
        <AjaxSettings> 
            <rad:AjaxSetting AjaxControlID="Filter">  
                <UpdatedControls> 
                    <rad:AjaxUpdatedControl ControlID="Filter" LoadingPanelID="LoadingPanel"/>  
                    <rad:AjaxUpdatedControl ControlID="TreeView" LoadingPanelID="LoadingPanel"/>  
                </UpdatedControls> 
           </rad:AjaxSetting> 
        </AjaxSettings> 
    </rad:RadAjaxManagerProxy> 
    Next code, throws
    "Microsoft JScript runtime error: Sys.InvalidOperationException: Could not find UpdatePanel with ID 'ctl00$ctl00$MainMasterContent$MainContent$TreeViewPanel'. If it is being updated dynamically then it must be inside another UpdatePanel."
    when user click apply button:
    protected void Page_Load(object sender, EventArgs e)     
    {     
        var applyFilterButton = Filter.Controls.OfType<Button>().First();     
        
        var ajaxSetting = new AjaxSetting(applyFilterButton.UniqueID);     
        ajaxSetting.UpdatedControls.Add(new AjaxUpdatedControl(TreeView.ID, LoadingPanel.ID));     
        AjaxManagerProxy.AjaxSettings.Add(ajaxSetting);     
    }   

    Please, help solve this problem.
  2. Answer
    Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 22 Jun 2010 Link to this post

    Hello Jonny,

    Following demo shows how you can trigger filtering on RadFilter from external button:
    http://demos.telerik.com/aspnet-ajax/filter/examples/filterinradwindow/defaultcs.aspx

    Few steps are required:
     - set ShowApplyButton="false" of RadFilter
     - create custom button and attach click handler:
    <asp:LinkButton runat="server" ID="ApplyButton" 
     OnClick="ApplyButton_Click" Text="Apply Expressions"/>

     - on click handler call FireApplyCommand of RadFilter:
    protected void ApplyButton_Click(object sender, EventArgs e)
    {
       RadFilter1.FireApplyCommand();
    }

     - ajaxify the button to update target control
    <telerik:AjaxSetting  AjaxControlID="ApplyButton">
      <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
      </UpdatedControls>
    </telerik:AjaxSetting>


    Regards,
    Nikolay
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jonny
    Jonny avatar
    5 posts
    Member since:
    Apr 2010

    Posted 22 Jun 2010 Link to this post

    Thank you, i miss this event.
Back to Top