c# - Removing generated stylesheet reference -


in page_load of masterpage, i've programmatically added reference styleheet:

htmllink css = new htmllink(); css.attributes.add("rel", "stylesheet"); css.attributes.add("type", "text/css"); css.attributes.add("id", "admin_style"); css.href = "style_admin.css"; page.header.controls.add(css); 

now wish remove reference again, can't seem working. i've tried simple findcontrol on id , .remove(), doesn't seem work.

does know how remove reference?

htmllink css = new htmllink(); css.attributes.add("rel", "stylesheet"); css.attributes.add("type", "text/css"); css.href = "style_admin.css"; css.id = "admin_style";  page.header.controls.add(css); 

and remove via

foreach (control ctrl in page.header.controls) {     var htmllink = ctrl htmllink;     if (htmllink != null)     {         if (htmllink.id == "admin_style")             page.header.controls.remove(htmllink);     } } 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -