How to edit CSS style of a div using C# in .NET

后端 未结 9 1613
心在旅途
心在旅途 2020-12-03 09:26

I\'m trying to grab a div\'s ID in the code behind (C#) and set some css on it. Can I grab it from the DOM or do I have to use some kind of control?

9条回答
  •  伪装坚强ぢ
    2020-12-03 10:09

    Make sure that your div is set to runat="server", then simply reference it in the code-behind and set the "class" attribute.

    ...content...

    Code-behind

    formSpinner.Attributes["class"] = "class-name";
    

提交回复
热议问题