Problem with Page refresh for Treeview control

9 posts, 0 answers
  1. Rajesh Aggarwal
    Rajesh Aggarwal avatar
    9 posts
    Member since:
    Mar 2009

    Posted 14 Apr 2009 Link to this post

    We are having a problem with the RadTreeView control.  After creating an Event (it doesn't matter if its just a single or a recurring event...), when you refresh the page, another event is created... basically a duplicate of what you just created. 

    I wonder if this is a bug or am just missing something (i.e., needs to declare something, etc...).  Below are the step-by-step detail in recreating the issue:

    1.  Invoke a treeview event such as add / remove node on server side.
    2.  Click on the browser's "Page Refresh" button or "F5"... you will notice that a duplicate event is created.

    What should we do to prevent this issue from happening?

    Thanks for your help.
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 14 Apr 2009 Link to this post

    Hello Rajesh Aggarwal,

    I am confused which control are you using. You are speaking of RadTreeView but then you mention recurring events which are part of RadScheduler.

    When you hit the refresh button after a postback (HTTP post request) the last request is resubmitted. This means that the form is posted again which effectively redoes the previous action. The most commonly used workaround is to ajaxify the page so there are no postbacks.

    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. Rajesh Aggarwal
    Rajesh Aggarwal avatar
    9 posts
    Member since:
    Mar 2009

    Posted 14 Apr 2009 Link to this post

    I am using RadTreeview and RadGrid controls. Ignore the Scheduler part of it because I cut and paste from an earlier post. I am doing add / remove /rename nodes on the Treeview control and drag-and-drip grid rows to the tree. If I refresh the page then the previous event gets fired on page reload. How can I prevent that. Can you give me an exmple of how I can achieve this with ajax?
    Thanks.
  4. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 14 Apr 2009 Link to this post

    Hello Rajesh Aggarwal,

    You can use RadAjaxPanel or RadAjaxManager in order to ajaxify your application. To do a test just wrap your controls inside a RadAjaxPanel control:

    <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1">
           <telerik:RadTreeView runat="server" ID="RadTreeView1" />
    </telerik:RadAjaxPanel>

    Greetings,
    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.
  5. Rajesh Aggarwal
    Rajesh Aggarwal avatar
    9 posts
    Member since:
    Mar 2009

    Posted 14 Apr 2009 Link to this post

    I have put a RadAjaxPanel around my RadTreeview and RadGrid controls. This seems to solve the problem of page refresh. However when I try to invoke another event after the first one I am getting "Invalid JSON primitive" error. How can I resolve that?
    Thanks,
  6. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 14 Apr 2009 Link to this post

    Hello Rajesh Aggarwal,

    We are not sure why this error may occur. Please open a support ticket and send us a runnable version of your page which demonstrates the JavaScript error. Thanks.

    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.
  7. Rajesh Aggarwal
    Rajesh Aggarwal avatar
    9 posts
    Member since:
    Mar 2009

    Posted 14 Apr 2009 Link to this post

    Can you give me an example of how I can use RadAjaxManager? Do I put both RadTreeView and RadGrid inside RadAjaxManager wrapper?
    Thanks,
  8. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 14 Apr 2009 Link to this post

    Hello Rajesh Aggarwal,

    Please check this help article which demonstrates how to ajaxify controls with RadAjaxManager. Here is a sample declaration which shows how to ajaxify RadTreeView and RadGrid:

            <telerik:RadAjaxManager runat="server" ID="RadAjaxMAnager1">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadTreeView1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                            <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                            <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>               
                </AjaxSettings>
            </telerik:RadAjaxManager>

    Greetings,
    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.
  9. Rajesh Aggarwal
    Rajesh Aggarwal avatar
    9 posts
    Member since:
    Mar 2009

    Posted 15 Apr 2009 Link to this post

    Thanks. That solved my problem.
    -rajesh
Back to Top