.net - Adding CSS class through ASPX code -


i using aspx. if have html follows:

<div id="classme"></div> 

i hoping dynamically add css class through code behind file, i.e. on page_load. possible?

if want use control on serverside make runat=server or better: use servercontrol in first place. in case should use panel rendered div:

<asp:panel id="panelid" cssclass="classme" runat="server"></asp:panel> 

or codebehind:

protected void page_load(object sender, eventargs e) {     panelid.cssclass = "classme"; } 

but if want stay div:

<div id="divid" runat="server"></div> 

codebehind:

protected void page_load(object sender, eventargs e) {     divid.attributes.add("class", "classme"); } 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -