treeview update before button click

2 posts, 0 answers
  1. Spire
    Spire avatar
    8 posts
    Member since:
    Jan 2010

    Posted 16 Feb 2011 Link to this post

    Hi,

    I can't seems to solve a problem that the usercontrol where I have my TreeView updates before "btnSavePage" button event fires.
    I need a way to update the TreeView after the button event has been fired.
    Could someone point me in the right direction?

    My Code:
    UserControl:
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server" >       
            <AjaxSettings>       
                <telerik:AjaxSetting AjaxControlID="tvPages" EventName="onnodedrop">           
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="tvPages" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting
                    <telerik:AjaxSetting AjaxControlID="btnSavePage" EventName="onclick" >
                    <UpdatedControls>                   
                        <telerik:AjaxUpdatedControl ControlID="tvPages" LoadingPanelID="RadAjaxLoadingPanel1"  />
                    </UpdatedControls>
                </telerik:AjaxSetting>       
            </AjaxSettings>
        </telerik:RadAjaxManagerProxy>
        <asp:Panel ID="pnlPageTree" runat="server">
            <telerik:RadTreeView ID="tvPages" runat="server" EnableDragAndDrop="true" PersistLoadOnDemandNodes="false"  EnableDragAndDropBetweenNodes="true"
                onnodedatabound="tvPages_NodeDataBound" onnodedrop="tvPages_NodeDrop"
                ondatabinding="tvPages_DataBinding" >              
            </telerik:RadTreeView>
        </asp:Panel>

    WebForm:
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server" >
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="btnSavePage" EventName="onclick" >
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="pnlPage" LoadingPanelID="RadAjaxLoadingPanel1" />                   
                    </UpdatedControls>
                </telerik:AjaxSetting>           
            </AjaxSettings>
        </telerik:RadAjaxManagerProxy>
    <asp:Button ID="btnSavePage" runat="server" Text="Lagre" onclick="btnSavePage_Click" />
  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 18 Feb 2011 Link to this post

    Hello Spire,

    Your treeview is updated before clicking the button, since you have allowed to be updated by itself beside from the button click.    
    <telerik:AjaxSetting AjaxControlID="tvPages" EventName="onnodedrop">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="tvPages" LoadingPanelID="RadAjaxLoadingPanel1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>

    With this setting your treeview is initiating update on itself and that is why it's updated before clicking on the button.  If you want only the button to be able to update the treeview remove this ajax setting.



    Regards,
    Dimitar Terziev
    the Telerik team
Back to Top