Solved

Create DIV from Server Side

Posted on 2006-07-19
4
2,090 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Suggested Solutions

Title # Comments Views Activity
Moving code from one TFS branch to another 3 33
asp.net mvc5 6 23
asp.net input html code have it display the content 2 22
ASP.NET (VB) return a record 2 38
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.…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

831 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