how to add css class to html generic control div?

前端 未结 9 2214
名媛妹妹
名媛妹妹 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:50

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

    element.Attributes.Add("class", element.Attributes["class"] + " " + sType);
    

提交回复
热议问题