Solved

Create DIV from Server Side

Posted on 2006-07-19
4
2,087 Views
Last Modified: 2008-01-09
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?



0
Comment
Question by:pradeepsudharsan
  • 2
  • 2
4 Comments
 
LVL 15

Expert Comment

by:GavinMannion
ID: 17136546
Instead of creating a Div Control just create the HTML dynamically.

Dim myDiv as String
myDiv = "<div id='blah'>afjkhafja</div>"

Then bind that to a placeholder or label or Response.Write it
0
 
LVL 7

Author Comment

by:pradeepsudharsan
ID: 17137515
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).Controls.Item(0), HtmlGenericControl)
                dv.Controls.Add(uc)

0
 
LVL 7

Author Comment

by:pradeepsudharsan
ID: 17137536
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").Controls.Add(uc)
0
 
LVL 15

Accepted Solution

by:
GavinMannion earned 500 total points
ID: 17137541
Oh, Okay.

Then use a Panel.

Dim p as Panel
p.ID = "MyDiv";
p.Controls.Add(User Control);

me.Controls.Add(p)
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now