使用服务器端参数自定义我的mvc应用程序(customizing my mvc app with server side parameters)
我有一个mvc应用程序,主要是客户端与knockoutjs。 我需要为不同类型的安装配置它,所以我将为某些颜色提供自定义参数。 现在我将所有内容都放在客户端的js文件中,但因为这是在应用程序运行时不会改变的东西我想在服务器端放置它并根据这些自定义参数修改我的视图所以页面将只是使用正确的颜色呈现服务器端。
使用MVC的最佳方法是什么? 我发现使用的所有答案:
ConfigurationManager.GetSection
从web.config文件中读取但是它不是很清楚它是否在mvc中工作,如果之后我需要将值放在模型中并将其附加到视图中。这样的事情总是被建议:
var somevar = "@item"
item
var somevar = "@item"
但是视图中的item
是什么?I have an mvc app that works mostly client side with knockoutjs. I have the need of configuring it for different type of installations so I will have custom parameters for some colors for example. Now I put everything in a js file on the client, but because this is something that does not change while the app is running I was thinking to put this on the server side and modify my view depending on those custom params so the page will just be rendered server side with the right colors.
What is the best way of doing this with MVC? all the answers I found use:
ConfigurationManager.GetSection
to read from the web.config file but it's not very clear if it works in mvc and if after that I need to put the values in a model and attach it to the view.something like this is suggested all the time:
var somevar = "@item"
but what isitem
in an view?
原文:https://stackoverflow.com/questions/18465025
最满意答案
w3resource示例的问题是添加到#example div的“in”类。 如果删除“in”类,它应该按照您期望从顶部滑入的方式工作...
<div class="container"> <h2>Example of creating Modals with Twitter Bootstrap</h2> <div id="example" class="modal hide fade" style="display: none; "> <div class="modal-header"> <a class="close" data-dismiss="modal">×</a> <h3>This is a Modal Heading</h3> </div> <div class="modal-body"> <h4>Text in a modal</h4> <p>You can add some text here.</p> </div> <div class="modal-footer"> <a href="#" class="btn btn-success">Call to action</a> <a href="#" class="btn" data-dismiss="modal">Close</a> </div> </div> <p><a data-toggle="modal" href="#example" class="btn btn-primary btn-large">Launch demo modal</a></p> </div>
使用Bootply : http : //www.bootply.com/60158
The problem the w3resource example was the "in" class added to the #example div. If you remove the "in" class it should work the way you expect an slide in from the top...
<div class="container"> <h2>Example of creating Modals with Twitter Bootstrap</h2> <div id="example" class="modal hide fade" style="display: none; "> <div class="modal-header"> <a class="close" data-dismiss="modal">×</a> <h3>This is a Modal Heading</h3> </div> <div class="modal-body"> <h4>Text in a modal</h4> <p>You can add some text here.</p> </div> <div class="modal-footer"> <a href="#" class="btn btn-success">Call to action</a> <a href="#" class="btn" data-dismiss="modal">Close</a> </div> </div> <p><a data-toggle="modal" href="#example" class="btn btn-primary btn-large">Launch demo modal</a></p> </div>
Working on Bootply: http://www.bootply.com/60158
相关问答
更多-
因此,据我所知,twitter bootstrap不会暴露传送带通过事件对象移动的方向。 但是,它会为幻灯片中涉及的元素添加“右”或“左”类。 所以基本上我看到2个选项。 在事件对象中公开方向或在元素上查找右侧或左侧的类。 选项1: 您将不得不修改引导程序轮播代码。 在旋转木马中,滑动功能改变: e = $.Event('slide') 至 e = $.Event('slide', {direction: direction}) (在bootstrap.js的正常版本中大约在337-340行) 然后你可 ...
-
Bootstrap 3现在使用CSS变换translate3d而不是CSS转换,以使用GPU硬件加速更好的动画。 它使用以下CSS(无缓和) .modal.fade .modal-dialog { -webkit-transform: translate3d(0, -25%, 0); transform: translate3d(0, -25%, 0); } 这是CSS可以用来从LEFT侧滑入 .modal.fade:not(.in) .modal-dialog { -webkit ...
-
Twitter Bootstrap模式:如何清除幻灯片下拉效果(Twitter Bootstrap modal: How to remove Slide down effect)[2021-12-03]
只需从模态div中取出fade课程。 具体来说,改变: