how to add css class to html generic control div?

前端 未结 9 2190
名媛妹妹
名媛妹妹 2020-12-13 08:21

I created a div tag like this:

System.Web.UI.HtmlControls.HtmlGenericControl dynDiv = 
    new System.Web.UI.HtmlControls.HtmlGenericControl(\"DIV\");
         


        
9条回答
  •  粉色の甜心
    2020-12-13 08:51

    Alternative approach if you want to add a class to an existing list of classes of an element:

    element.Attributes["class"] += " myCssClass";
    

提交回复
热议问题