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

[Solved] Controls don't work after replacing div

3 Answers 78 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Trent
Top achievements
Rank 1
Trent asked on 29 Feb 2012, 04:00 AM
I'm building a quick expense claim app as a POC for my company. I have a page with the model bound to an expense claim. I need to have a popup window to allow the user to add new expense items. I've done this as follows:

1. On the Expense claim form I have a hidden window with an empty div
2. When the user clicks the 'Add Item' button I get the 'AddExpenseItem' partial view, replace the empty div in the window with this partial view and then show the window.

This works great, except when I open the window a second time the controls don't work - clicking dropdowns doesn't open them and the date picker doesn't open etc. 

I should also add that the AddExpenseItem view is bound to an expense item. When it wasn't bound to the model (i.e. just an ajax form) it worked fine.

Any help would be hugely appreciated, thanks!

3 Answers, 1 is accepted

Sort by
0
Accepted
Petur Subev
Telerik team
answered on 29 Feb 2012, 12:12 PM
Hi Trent,

Make sure you followed the steps covered in this documentation section related to "loading partial views with Ajax".
If you need further assistance please explain at which step exactly you are facing a problem and provide the code you are using.
 
Greetings,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Trent
Top achievements
Rank 1
answered on 01 Mar 2012, 01:22 AM
Thank you very much Petur. It turns out I was doing it correctly (which your link confirmed) but the issue was caused by the fact that I had model.comment bound to a textbox and I also had a hidden field for model.comment. When this happens the controls stop functioning. My fault, but surprisingly hard to find the issue.

Thanks again for your help.
0
Ignacio
Top achievements
Rank 1
answered on 30 May 2012, 02:47 PM
Hi Petur,

I am having the same issue with my webpage and I am following the documentation for working with AJAX but the controls still doen't work.

I have a splitter in my page, and I return through a AJAX call the HTML(which is a partial view that contains two partial views) for two of the splitters. Once I retrieve the HTML, I separate each partial view with the data and paste them in their correspondient splitter part.

If I paste the whole HTML to one of the splitters as I receive it from the server, the controls work fine, but when I split it into different ones the controls don't work anymore.

Any clue on how can I do it? I don't want if it possible to do two request to the server to retrieve the same data for each splitter.

Thank you so much for your help!

Tags
General Discussions
Asked by
Trent
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Trent
Top achievements
Rank 1
Ignacio
Top achievements
Rank 1
Share this question
or