从文件后面的代码中的HTML元素中删除CSS类 [英] Remove a CSS class from HTML element in the code behind file

查看:88
本文介绍了从文件后面的代码中的HTML元素中删除CSS类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的界面/网络表单中有以下内容:

I have the following on my interface / webform:

<div id="mydiv" class="forceHeight" runat="server" />

现在我的代码中有一个条件,如果某些情况为真,我需要从该控件中删除 forceHeight 类.我知道您可以在C#中使用:

Now I have a condition in my code behind where if a certain situation is true I need to remove the forceHeight class from this control. I know in C# you can use:

mydiv.CssClass.Replace("forceHeight", ""); 

我不确定您如何使用VB进行此操作?Intellisense不向我提供此选项吗?

I'm not so sure how you do this using VB? Intellisense doesn't offer me this option?

有任何想法吗?

推荐答案

这将使用 ID ="mydiv"

Me.mydiv.Attributes("class") = ""

这篇关于从文件后面的代码中的HTML元素中删除CSS类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆