pradeepsudharsan
asked on
Create DIV from Server Side
I am in need to create a DIV from server side.
If i create a new HTML generic control only a SPAN is created.
(Dim A As New HtmlGenericControl)
So plz tell me what is the property to convert a SPAN to DIV?
If i create a new HTML generic control only a SPAN is created.
(Dim A As New HtmlGenericControl)
So plz tell me what is the property to convert a SPAN to DIV?
ASKER
I tried the code
But i am in need to create a DIV .so that we could bind an user control in that DIV.
Dim cell As New HtmlTableCell
Dim strdiv As String
cell = Table1.Rows(0).Cells(0)
strdiv = "<div id=" & "'div1'" & " style=" & "'Z-INDEX: 105; WIDTH: 100%; POSITION: absolute; HEIGHT: 100%'" & " runat=" & "'server'" & ">" & "</div>"
cell.InnerHtml = strdiv
Dim uc As UserControl
Dim dv As New HtmlGenericControl
uc = Page.LoadControl("UC.ascx" )
uc.Visible = True
dv = CType(Table1.Rows(0).Cells (0).Contro ls.Item(0) , HtmlGenericControl)
dv.Controls.Add(uc)
But i am in need to create a DIV .so that we could bind an user control in that DIV.
Dim cell As New HtmlTableCell
Dim strdiv As String
cell = Table1.Rows(0).Cells(0)
strdiv = "<div id=" & "'div1'" & " style=" & "'Z-INDEX: 105; WIDTH: 100%; POSITION: absolute; HEIGHT: 100%'" & " runat=" & "'server'" & ">" & "</div>"
cell.InnerHtml = strdiv
Dim uc As UserControl
Dim dv As New HtmlGenericControl
uc = Page.LoadControl("UC.ascx"
uc.Visible = True
dv = CType(Table1.Rows(0).Cells
dv.Controls.Add(uc)
ASKER
sorry try this code.
Table1 is created in the design time itself.
Dim cell As New HtmlTableCell
Dim strdiv As String
cell = Table1.Rows(0).Cells(0)
strdiv = "<div id=" & "'div1'" & " style=" & "'Z-INDEX: 105; WIDTH: 100%; POSITION: absolute; HEIGHT: 100%'" & " runat=" & "'server'" & ">" & "</div>"
cell.InnerHtml = strdiv
Dim uc As UserControl
uc = Page.LoadControl("UC.ascx" )
uc.Visible = True
Page.FindControl("div1").C ontrols.Ad d(uc)
Table1 is created in the design time itself.
Dim cell As New HtmlTableCell
Dim strdiv As String
cell = Table1.Rows(0).Cells(0)
strdiv = "<div id=" & "'div1'" & " style=" & "'Z-INDEX: 105; WIDTH: 100%; POSITION: absolute; HEIGHT: 100%'" & " runat=" & "'server'" & ">" & "</div>"
cell.InnerHtml = strdiv
Dim uc As UserControl
uc = Page.LoadControl("UC.ascx"
uc.Visible = True
Page.FindControl("div1").C
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Dim myDiv as String
myDiv = "<div id='blah'>afjkhafja</div>"
Then bind that to a placeholder or label or Response.Write it