简体   繁体   English

ValidationSummary控件上的ASP.Net垂直间距

[英]ASP.Net vertical spacing on a ValidationSummary control

Within ASP.Net 4.0 is it possible to increase the vertical spacing between the errors\\warnings that appear on a ValidationSummary control? 在ASP.Net 4.0中,是否可以增加ValidationSummary控件上出现的错误\\警告之间的垂直间距?

I'm finding that they are just a little to close to each other. 我发现它们之间只有一点距离。

Thanks 谢谢

As above (IrishChieftain) but target the li nodes that get generated? 如上(IrishChieftain)但针对生成的li节点呢?

<asp:ValidationSummary CssClass="valSummary"

.valSummary li 
{
    padding-bottom: 10px;
}

If you want to have the ValidationSummary with a displaymode of 'List' then you have very little chance to style this as the html that is generated is just text with breaks 如果您希望显示模式为“列表”的ValidationSummary,那么您几乎没有机会设置其样式,因为生成的html只是带有中断的文本

eg 例如

<div id="MainContent_ValidationSummary1" class="valSummary" style="">
    Following error occurs:
    <br>
    Input Country!
    <br>
    Input Region!
    <br>
</div>

However you can set the DisplayMode to be BulletList and use CSS to hide the bullet points which will give you the same effect 但是,您可以将DisplayMode设置为BulletList并使用CSS隐藏项目符号点,从而获得相同的效果

eg 例如

<asp:ValidationSummary CssClass="valSummary" DisplayMode="BulletList" .. />

.valSummary li 
{
    padding-bottom: 10px;
    list-style-type: none; /* Or can just use list-style: none; */
}

Which is what I think you are after. 我想你是在追求什么。

Just add some padding in CSS and apply that CSS class in your markup, to the control. 只需在CSS中添加一些填充并将该CSS类在您的标记中应用于控件即可。

.valSummary
{
    padding-bottom: 10px;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM