Add to List from codebehind C# Asp.net

后端 未结 5 1010
春和景丽
春和景丽 2020-12-09 03:10

I have a UL list in a ASPX page:

  • Tab 1
5条回答
  •  时光说笑
    2020-12-09 03:26

    nested it with parent child,use your elements as below

    Dim newLi = New HtmlGenericControl("li")
            Dim anchor = New HtmlGenericControl("a")
            anchor.Attributes.Add("href", itemrow.Item("reg_url").ToString().Trim())
            anchor.InnerText = itemrow.Item("conf_name")
            newLi.Controls.Add(anchor)
            eventList.Controls.Add(newLi)
    

提交回复
热议问题