Initiate TreeView.LoadXml from ToolbarButton

4 posts, 0 answers
  1. Juergen Puscher
    Juergen Puscher avatar
    5 posts
    Member since:
    Jul 2009

    Posted 14 Aug 2009 Link to this post

    Hi,

    I just recognized that RadToolbarButtons does not have a ID Attribute and that RadToolbarButtons and RadTreeView are not supported by RadAjaxManager. So how can I find a solution for the following scenario?

    I've a RadToolbar with RadToolbarButtons and a empty RadTreeview on my Page.
    When I click the RadToolbar Button i want to raise a AjaxRequest to the CodeBehind Class. There is a function which should load the RadTreeView via LoadXml. After this the RadTreeview on the Page should be rerendered to show the loaded values.

    This should happen without full page Postbacks.

    Thank you for help

    regards

    Alex
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 14 Aug 2009 Link to this post

    Hi Juergen Puscher,

    RadAjaxManager supports ajaxifying of the whole RadToolBar control and configuring it to update RadTreeView. I suggest you implement the required logic using regular postbacks and then adding RadAjaxManager.

    Regards,
    Albert,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Juergen Puscher
    Juergen Puscher avatar
    5 posts
    Member since:
    Jul 2009

    Posted 14 Aug 2009 Link to this post

    Hi Albert,

    i mixed up the Support of standard ASP.NET TreeView . So now I see, that the controls supports AJAX funcionality.

    But I've still problems with the Toolbar and the TreeView.

    I want that a click on a RadToolbarButton updates the RadTreeView. So I started the RadAjaxManager SmartWizard. There I found the RadToolbarButton with id 'i0' (Other ToobarButtons use the same id).
    Now I select the TreeView as Update Target.

    After starting the application i get the Errormessage (Sorry the message is in German):
    Die Steuerelementeauflistung kann nicht geändert werden, da das Steuerelement Codeblöcke enthält (z.B. <% ... %>).  
    Beschreibung: Unbehandelte Ausnahme beim Ausführen der aktuellen Webanforderung. Überprüfen Sie die Stapelüberwachung, um weitere Informationen über diesen Fehler anzuzeigen und festzustellen, wo der Fehler im Code verursacht wurde.  
     
    Ausnahmedetails: System.Web.HttpException: Die Steuerelementeauflistung kann nicht geändert werden, da das Steuerelement Codeblöcke enthält (z.B. <% ... %>). 
     
    Quellfehler:  
     
    Beim Ausführen der aktuellen Webanforderung wurde einen unbehandelte Ausnahme generiert. Informationen über den Ursprung und die Position der Ausnahme können mit der Ausnahmestapelüberwachung angezeigt werden.   
     
    Stapelüberwachung:  
     
     
    [HttpException (0x80004005): Die Steuerelementeauflistung kann nicht geändert werden, da das Steuerelement Codeblöcke enthält (z.B. <% ... %>).] 
       System.Web.UI.ControlCollection.AddAt(Int32 index, Control child) +8664706 
       Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +214 
     
    [HttpException (0x80004005): Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error.] 
       Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +279 
       Telerik.Web.UI.RadAjaxControl.PerformRender() +502 
       Telerik.Web.UI.RadAjaxControl.OnPageRender(HtmlTextWriter writer, Control page) +1849 
       Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +158 
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256 
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19 
       System.Web.UI.Page.Render(HtmlTextWriter writer) +29 
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266 
     
      
     
     
    -------------------------------------------------------------------------------- 
    Versionsinformationen: Microsoft .NET Framework-Version:2.0.50727.3053; ASP.NET-Version:2.0.50727.3053  


    My JavaScript Functions are located in a RadCodeBlock to prevent errors when using  (<%=xyzControl.ClientID %>) inside JavaScriptfunctions.

    My TreeView looks like this:
    <div id="div_RadTreeViewDataFilterAll"
        <telerik:RadTreeView  
            ID="RadTreeViewDataFilterAll"  
            Runat="server"  
            CheckBoxes="True"  
            EnableDragAndDrop="True"  
            TriStateCheckBoxes="True"  
            CheckChildNodes="False" 
            OnClientNodeChecked="RadTreeViewDataFilterAll_OnClientNodeChecked" 
            OnClientContextMenuItemClicked="RadTreeViewDataFilterAll_OnClientContextMenuItemClicked" 
            OnClientContextMenuShowing="RadTreeViewDataFilterAll_OnClientContextMenuShowing" 
            OnClientNodeDragStart="RadTreeViewDataFilterAll_OnClientNodeDragStart" 
            OnClientNodeClicked="RadTreeViewDataFilterAll_OnClientNodeClicked" 
            OnClientNodeDropped="RadTreeViewDataFilterAll_OnClientNodeDropped"
            <Nodes> 
                <telerik:RadTreeNode runat="server" Checkable="False" Text="Available Filters"></telerik:RadTreeNode> 
            </Nodes> 
            <contextmenus> 
                <telerik:RadTreeViewContextMenu ID="RadTreeViewAllDataFiltersContextMenu" runat="server"
                    <Items> 
                        <telerik:RadMenuItem  runat="server" Text="Select Filter" Value="select"></telerik:RadMenuItem> 
                        <telerik:RadMenuItem  runat="server" Text="Remove Filter" Value="remove"></telerik:RadMenuItem> 
                    </Items> 
                </telerik:RadTreeViewContextMenu> 
            </contextmenus> 
        </telerik:RadTreeView> 
    </div>   

    So i dont understand, how the RadAjaxManager locate the correct RadToolbarButton, if it does not have a ID. Or if it is invisible. it may be the same id as other Toolbarbuttons? Maybe the RadAjaxManger tries to get the ID with <%=RadToolBatButton1.ClientID%> and this raise the Error. But how should I use the RadAjaxManager to update the RadTreeView, when the RadToolbarButton was clicked?



    regards

    Jürgen

  4. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 14 Aug 2009 Link to this post

    Hello Juergen Puscher,

    Please pick the toolbar not the button as ajax initiator. RadAjaxManager cannot ajaxify individual buttons.

    Regards,
    Albert,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top