简体   繁体   English

设计asp.net表单时在Visual Studio设计图面上禁用css / Style

[英]disable css/Style on Visual Studio Design Surface while designing asp.net form

did any one know how do i disable css/style on the visual stdio 2010 design surface. 有谁知道我如何在视觉stdio 2010设计图面上禁用css / style。

for example. 例如。

i have this button on my aspx page 我在aspx页面上有此按钮

<asp:Button id="btnShowPopup_Collateral" runat="server" style="display:none" />

i have put the style on the button to hide it on the webpage. 我将样式放在按钮上以将其隐藏在网页上。 but its does not even show on the visual studio design surface. 但它甚至没有在视觉工作室设计图上显示。 i hope you guys understand what im trying to ask. 我希望你们能理解我要问的问题。

im new to visual studio 2010 我是Visual Studio 2010的新手

thanks kay 谢谢凯

The design page only shows controls that are visible on page load. 设计页面仅显示页面加载时可见的控件。 Since you have set your control to be invisible, it will not appear on the design page. 由于您已将控件设置为不可见,因此它不会出现在设计页面上。 This is also true if you have controls in a that you have hidden. 如果您在中隐藏了控件,则也是如此。 I don't know of anyway to turn off styles on the design page, but since the page is rendered from the in the codeing page, turning off that styles would most likely leave you with nothing. 无论如何,我都不知道要关闭设计页面上的样式,但是由于该页面是从代码页面中的呈现的,因此关闭该样式很可能使您一无所有。

If you absolutely must see the button on the design page, i suggest leaving out the hidden snippet while designing and putting it back in when testing the page etc. If you absolutely MUST show it on the design without changing the code, then set the property so it is visible, and go to the form_load code behind page where you can set that control to hidden there. 如果您绝对必须在设计页面上看到该按钮,那么我建议在设计时将隐藏的代码段省略掉,并在测试页面等时将其放回去。因此它是可见的,然后转到页面后面的form_load代码,您可以在其中将该控件设置为隐藏。 Then your design page will show the button, but when the page loads it hides again. 然后,您的设计页面将显示该按钮,但是在页面加载时将再次隐藏。 This is most likely a poor technique and definitely won't win any "best practice" awards though. 这很可能是一项糟糕的技术,但是绝对不会赢得任何“最佳实践”奖。

Sorry for the super late reply, but better late than never i guess. 很抱歉收到超级回复,但迟到总比没有好。

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

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