Bundling content instead of references in ASP.Net 4.5.1? -
our single page web applications using bootstrap modal windows. bootstrap seems hide them until they're needed appending modal html bottom of form seems simple enough plan.
to organization, i'd similar bundling js files. however, don't want bundle output links files contain modal dialog html, want bundle actual content in these files , inserted @ bottom of document.
i've looked bundle options seem less, style, , script. seems safe bet these generate references files , not insert file's contents i'm looking for.
if bundles aren't way go, alternative have inject file's contents page on server side?
i believe can accomplish want through use of @html.partial() not require or use controller action.
we use approach create subsections 'included' larger body of html, such our script links, css links, html templates , markup our modals.
if have bootstrap modal following markup:
<div class="modal fade"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">close</span></button> <h4 class="modal-title">modal title</h4> </div> <div class="modal-body"> <p>one fine body…</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">close</button> <button type="button" class="btn btn-primary">save changes</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> and place view in ~/views/shared/ folder, name _modalmymodal, should able reference view , include markup using:
@html.partial("_modalmymodal")
the end result should same if placed markup modal directly in parent view.
we try remember include begin , end comments on these partials mark them within larger body of markup. like:
<!-- begin _modalmymodal --> ... <!-- end _modalmymodal -->
Comments
Post a Comment