I am creating custom web part editor part. I have created a text box which should only allow integer values. If non integer value is filled in , after clicking on "Apply" , error message is displayed on the label below it.

enter image description here

Problem : The label to show error message is initially set to visible = false. But still the editor web part occupies the space(Marked on Red box). How can i remove the space ? enter image description here

  • You might want to work on a more friendly message...
    – SHug
    Oct 8, 2011 at 15:55

2 Answers 2


I'd take a look at the rendered Toolpart in IE Dev tools, see what element's creating the space, and see if you can either eliminate it in the codebehind, or reduce it's spacing (padding, margins?) via CSS.


You can try to set Display="Dynamic" on the validator control (although it should not be rendered when visible=false). Maybe the additional space is cause by a line break between the TextBox and Validator control?

  • Display=dynamic did not work as in an adding the label through .cs file. There is not line break between textbox and validator control Sep 9, 2011 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.