On my control panel web page in ASP.NET MVC 3 site, a user can see his existing projects (its a site for designer portfolio), and can press a button to add a new project to the library.
A markup and the javascript dependencies for this particular "project adding functionality" are referenced in a partial view razor code.
Whenever a user click a button on a page, I retrieve the contents of the partial view and place them on the bottom of the page and call jQuery UI .dialog
on a generated div to display a project editing/adding popup.
But how can I invoke a logic to initialize validation and other logic (click handlers for example) that is referencing elements in this partial view content? (Due to this I can't just initialize everything at document ready)
Do I just hardcode some function in a linked js (for example initProjectEditing()) and call it from the code that initializes the popup, or is there a more elegant way of doing it?