简体   繁体   English

属性html控件

[英]attributes html controls

<td class="ui-widget-header gvHeader ui-helper-hidden" style="width: 17%" runat="server" id="tdPack">
Pack :
</td>

I want to remove the class 'ui-helper-hidden' using C# code. 我想使用C#代码删除“ ui-helper-hidden”类。 How ? 怎么样 ?

assuming several things due to lack of details, you might try: 假设由于缺乏细节有几件事,您可以尝试:

tdPack.CssClass = tdPack.CssClass.Replace("ui-widget-header", String.Empty);

or if that is HtmlTableCell than: 或如果是HtmlTableCell大于:

tdPack.Attributes["class"] =
       Attributes["class"].Replace("ui-widget-header", String.Empty);

first of all, you should retag your question! 首先,您应该重新标记您的问题!
then: provide more information! 然后:提供更多信息!
then: i assume that ui-helper-hidden is added by a plugin - this means, that this is not the rendered source rather the computed sourced - you will not be able to change the class -attribute... 然后:我假设ui-helper-hidden由插件添加-这意味着,这不是渲染的源,而是计算的源-您将无法更改class -attribute ...
the crucial question: do you know the difference between server- and client-side? 关键问题:您知道服务器端和客户端之间的区别吗?

you will have to use jquery or any other javascript (lib), to do sth like 您将必须使用jquery或任何其他javascript(lib)来做某事

$(document).ready(function () {
    var $cell = $('#yourControlId);
    // or
    var $cell = $('.ui-helper-hidden');
    $cell.removeClass('ui-helper-hidden');
});

another crucial question here: 这里的另一个关键问题是:
if this is your code, why don't you leave the unwanted ui-helper-hidden -class out? 如果这是您的代码,为什么不将不需要的ui-helper-hidden -class排除在外? your supported code shows, that you have the control over the code and there's no plugin or sth alike involved ... 您所支持的代码表明,您可以控制代码,并且不涉及插件或其他东西。

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

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