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

[Solved] TreeView actions missing after Ajax form update

2 Answers 121 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tx3
Top achievements
Rank 1
Tx3 asked on 09 Aug 2010, 07:24 AM

Hi,

I have a View that has some filters and then there is a TreeView control that is rendered according to those filters. My problem is that after POST all events of the TreeView are missing. How can I rebind those events again? As you can see on the source code, I only update translationContent div and that is where TreeView is defined.

1.<% using (Ajax.BeginForm("Translations", new { Model.Id }, new AjaxOptions { UpdateTargetId = "translationContent", InsertionMode = InsertionMode.Replace }, new { id = "translationAjaxForm" }))
2.   { %>

-Tatu

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 09 Aug 2010, 07:28 AM
Hi Tx3,

 I think the component is not initialized properly. Please check the using with ajax partial views help topic which shows what needs to be done.

Kind regards,
Atanas Korchev
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
Tx3
Top achievements
Rank 1
answered on 09 Aug 2010, 08:21 AM

Excellent! Only thing I had to add was

01.<script type="text/javascript">
02.    function updatePlaceholder(context) {
03.        // the HTML output of the partial view
04.        var html = context.get_data();
05.  
06.        // the DOM element representing the placeholder
07.        var placeholder = context.get_updateTarget();
08.  
09.        // use jQuery to update the placeholder. It will execute any JavaScript statements
10.        $(placeholder).html(html);
11.  
12.        // return false to prevent the automatic update of the placeholder
13.        return false;
14.    }
15.</script>

And 

Update my Ajax.BeginForm to this:

1.<% using (Ajax.BeginForm("Translations", new { Model.Id }, new AjaxOptions { OnSuccess = "updatePlaceholder", UpdateTargetId = "translationContent", InsertionMode = InsertionMode.Replace }, new { id = "translationAjaxForm" }))

Thanks for the help!

Tags
TreeView
Asked by
Tx3
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Tx3
Top achievements
Rank 1
Share this question
or