{"id":3405,"date":"2014-03-24T01:26:58","date_gmt":"2014-03-24T01:26:58","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/24\/change-css-element-value-dynamically-collection-of-common-programming-errors\/"},"modified":"2014-03-24T01:26:58","modified_gmt":"2014-03-24T01:26:58","slug":"change-css-element-value-dynamically-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/24\/change-css-element-value-dynamically-collection-of-common-programming-errors\/","title":{"rendered":"change css element value dynamically-Collection of common programming errors"},"content":{"rendered":"<p>There are several ways we do, \u00a0 Simplest way<\/p>\n<pre>\ntextBox1.Attributes[\"class\"] = \"class name\";\n<\/pre>\n<p>\u00a0 Another way is to use Web Extension,<\/p>\n<pre>\nstatic class WebControlsExtensions { public static void AddCssClass (this WebControl control, string cssClass) { control.CssClass += \" \" + cssClass; } public static void RemoveCssClass (this WebControl control, string cssClass) { control.CssClass = control.CssClass.replace(\" \" + cssClass, \"\");\n     }\n }\n<\/pre>\n<p>ctl.AddCssClass(&#8220;ReadOnly&#8221;); ctl.RemoveCssClass(&#8220;ReadOnly&#8221;); \u00a0 Hope this helps.<\/p>\n<p>cheers<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are several ways we do, \u00a0 Simplest way textBox1.Attributes[&#8220;class&#8221;] = &#8220;class name&#8221;; \u00a0 Another way is to use Web Extension, static class WebControlsExtensions { public static void AddCssClass (this WebControl control, string cssClass) { control.CssClass += &#8221; &#8221; + cssClass; } public static void RemoveCssClass (this WebControl control, string cssClass) { control.CssClass = control.CssClass.replace(&#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3405","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3405","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3405"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3405\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3405"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}