..:o5k4r.m4dr1d


Custom Validator and CheckBoxList

Posted in .Net 2005,.Net 2008,.NET 2010,.Net 2013,Desarrollo Web,Soluciones,Windows por o5k4r.m4dr1d en junio 22, 2017
Tags: , , , ,

Recently, I was working on WebForms, with a CustomValidator associated to a CheckBoxList. The validator is working correctly, but is shown on a new line. For the rest of the controls, like textbox or dropdownlist, it works perfectly.

CustomValidatorThis is caused because the Checkboxlist, generates a HTML table element, wich by default is a block level element.

To fix this, we must add a CSS class to the checkboxlist, with the style property:

{
float: left;
}

With this style, the CustomValidator will be shown next to the CheckBoxList.