Question regarding Visible=false and display:none;

前端 未结 4 1487
挽巷
挽巷 2021-01-18 08:19

If I set some control\'s property Visible=\"false\", I cant see the control in the HTML generated of my aspx page. But when I use display:none in style tag for that control,

4条回答
  •  轮回少年
    2021-01-18 08:50

    The Visible property is a property on the control - when set to false the control doesn't render at all. This is much better then setting display:none, in which case the control is rendered with a display:none style, so that the browser won't display it.

    The display:none can be useful if you don't want the control to be visible, but it contains some data that you want to use on the client (through Javascript, say). In such a case setting the Visible property to false won't work.

提交回复
热议问题