Solved

Create DIV from Server Side

Posted on 2006-07-19
4
2,094 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

739 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