create java script functions after rendering all partial views

Asked

Viewed 119 times

0

I have an aspnet MVC code with a main view that can call 3 view partials depending on where the user clicks.

one of these partial view was part of the main view and had a jquery sortable ui plug, while in the main view the plug worked perfectly but when I separated it to the partial view it stopped working, I believe it is because of the javascript / jquery methods that control the ui sortable that are in a ready..

I wonder if it is possible to create a function jquery "documentAndAllPartialViewsLoad" since I tried to even change the functions of jquery place.

3 answers

0

hello staff thanks for the help.

in case the problem was that the functions in the partial view was inside a Tage

@Section sript {} tag does not work in partial views

so was just change the tag why everything went to work.

0

where do the js include?!

make sure you are not doing includes after rendering the partials, and inside the partials try to use for example a jquery that is not yet loaded.

if this is the case, load the js and only then invoke the partials

0

Try to put the reference of your plugin in your Masterpage... This may be happening because the reference is being made in your Partial.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.