I wanted dynamic create some html and asp.net controls from code behind. When i click button (asp.net controls), it will run code below.
If Session("tbox") Is Nothing Then
Session("tbox") = 1
Else
Session("tbox") += 1
End If
Dim newcontrol As New HtmlGenericControl("div")
newcontrol.ID = "div" & Session("tbox")
newcontrol.Style.Add("background-color", "Green")
newcontrol.Style.Add("width", "150px")
newcontrol.Style.Add("height", "200px")
newcontrol.Style.Add("margin-left", "10px")
newcontrol.InnerHtml = "This is a dynamically created HTML server control. " & Session("tbox")
Mydiv.Controls.Add(newcontrol)
Dim newcontrol1 As New TextBox
n ...
Go to the complete details ...