“片面观点” “容器”的最佳实践; div?
处理部分视图的 html 标记的“最佳”方法是什么? (也使用 AJAX 刷新) 我遇到的最大问题是在哪里放置“容器”div...
考虑使用 母版页
和部分视图。
(class="" 可以与 id="" 互换,具体取决于部分是否保证是唯一的,但这对我认为的问题并不重要)
母版页:
<div id="place1" class="placeholder">
<!-- render partial -->
</div>
部分:
<div id="partial1" class="partial">
<!-- content -->
</div>
我觉得有些事情没有做对。但是,我无法删除母版页中的 div,因为我需要它来“封装”来自 AJAX 部分更新的响应。而且我也无法将部分中的 div 移动到母版页,因为这需要将“部分”信息移动到母版页...
你如何处理这个?
What is the 'best' way to handle the html markup for partial views? (which are also refreshed using AJAX) The biggest issue I run into is where to place the 'container' div...
Consider having a masterpage
and a partial view.
(class="" could be interchanged with id="" depending if the partial is guaranteed to be unique, however this isn't really important to the issue i think)
Masterpage:
<div id="place1" class="placeholder">
<!-- render partial -->
</div>
Partial:
<div id="partial1" class="partial">
<!-- content -->
</div>
I feel that something isn't being done right. However I cannot remove the div in the masterpage, because I need that to 'encapsulate' the response from AJAX partial updates. And also I cannot move the div in the partial to the masterpage, because that would require to move 'partial' info to the masterpage...
How do you handle this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想说的是,它对这里发生的事情进行语义描述,为样式和脚本编写提供良好的钩子,并且就针对未来使用和更改的总体鲁棒性而言,使用这两个 div 是最好的方法。
I would say that it terms of the semantic description of what is happening here, of providing good hooks for styling and scripting, and also in terms of general robustness against future uses and changes, that using both divs is the best way to go.