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

Ajax refresh only depended control on apply filter

2 Answers 64 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Jonny
Top achievements
Rank 1
Jonny asked on 19 Jun 2010, 08:36 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay Rusev
Telerik team
answered on 22 Jun 2010, 02:56 PM
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
0
Jonny
Top achievements
Rank 1
answered on 22 Jun 2010, 04:58 PM
Thank you, i miss this event.
Tags
Filter
Asked by
Jonny
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Jonny
Top achievements
Rank 1
Share this question
or