How do you set the “Visible” property of a ASP.NET control from a Javascript function?

后端 未结 9 647
不知归路
不知归路 2021-01-17 09:49

Bascially I want to know the best way to hide/show an ASP.NET control from a Javascript function. I figured I would just access the control in Javascript using:

<         


        
9条回答
  •  Happy的楠姐
    2021-01-17 10:16

    instead of using visible, set its css to display:none

    //css:
    .invisible { display:none; }
    
    //C#
    txtEditBox.CssClass = 'invisible';
    txtEditBox.CssClass = ''; // visible again
    
    //javascript
    document.getElementById('txtEditBox').className = 'invisible'
    document.getElementById('txtEditBox').className = ''
    

提交回复
热议问题