I'm using twitter bootstrap and alert elements to use within my web page and I want to use this as validation summary towards the top section of my page.
The issue that I have is when I use "alert alert-danger" on my create.chstml page, this displayed the red warning bar by default when the page is loaded.
The actual validation works on the form fields they are supposed to, however, I just need to find a way of hiding this warning bar when the page loads and then get this to kick in when my create button has been clicked.
I have tried some of the bootstrap properties like Hidden:hidden but this doesn't seem to work. Can I use javascript to plete this task and link this to the button create I have?
Here is the bootstrap I have on my create.cshtml
<div class="form-horizontal">
<div class="row" >
<div class="alert">
@Html.ValidationSummary(false, " ", new { @class = "text-danger alert alert-danger" })
</div>
</div>
</div>
I'm using twitter bootstrap and alert elements to use within my web page and I want to use this as validation summary towards the top section of my page.
The issue that I have is when I use "alert alert-danger" on my create.chstml page, this displayed the red warning bar by default when the page is loaded.
The actual validation works on the form fields they are supposed to, however, I just need to find a way of hiding this warning bar when the page loads and then get this to kick in when my create button has been clicked.
I have tried some of the bootstrap properties like Hidden:hidden but this doesn't seem to work. Can I use javascript to plete this task and link this to the button create I have?
Here is the bootstrap I have on my create.cshtml
<div class="form-horizontal">
<div class="row" >
<div class="alert">
@Html.ValidationSummary(false, " ", new { @class = "text-danger alert alert-danger" })
</div>
</div>
</div>
Share
Improve this question
edited Dec 19, 2016 at 11:43
Hudhaifa Yoosuf
9192 gold badges13 silver badges28 bronze badges
asked Dec 19, 2016 at 11:31
Betty LazzariBetty Lazzari
991 gold badge6 silver badges13 bronze badges
1
- 1 dddddduplicate check out the answer here – George Commented Dec 19, 2016 at 11:34
1 Answer
Reset to default 2Just use the hide class of bootstrap and when you click on button you can remove that class.
<div class="form-horizontal">
<div class="row" >
<div class="alert hide"> //add class here
@Html.ValidationSummary(false, " ", new { @class = "text-danger alert alert-danger" })
</div>
</div>
</div>
It will hide the alert on the page load and will work on button click as you want.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745280835a4620271.html
评论列表(0条)