473,383 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Where to generate literal controls

I'm not sure where I should be placing the code that creates my literal
controls. They are rendering but AFTER the close of the HTML tag.

I've tried Load, Init, PreLoad, PreInit, PreRender and get the same result
each time:

Example code:

Controls.Add(New LiteralControl("<div>"))
Dim lblItem As New Label
lblItem.Text = ("<p>") & item.Element("title").Value
lblItem.Font.Bold = True
lblItem.Style.Item("display") = "block"
lblItem.Style.Item("width") = "350px"
Controls.Add(lblItem)
Jul 13 '08 #1
4 1445
--Try to add a panel on the aspx page where u want all these literal
controls in the page...

let the panel u inserted in ur page is "asppanel1"
then u can add those literal controls as asppanel1.controls.Add(New
LiteralControl("<h1>"+(any thing u wanna display)+"</h1>"))
and u can place these this on "pageLoad" method....
On Jul 14, 3:59*am, "Scott M." <s-...@nospam.nospamwrote:
I'm not sure where I should be placing the code that creates my literal
controls. *They are rendering but AFTER the close of the HTML tag.

I've tried Load, Init, PreLoad, PreInit, PreRender and get the same result
each time:

Example code:

Controls.Add(New LiteralControl("<div>"))
Dim lblItem As New Label
lblItem.Text = ("<p>") & item.Element("title").Value
lblItem.Font.Bold = True
lblItem.Style.Item("display") = "block"
lblItem.Style.Item("width") = "350px"
Controls.Add(lblItem)
Jul 14 '08 #2
Can you show the html output you want to produce and what is the code
actually producing?

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Scott M." <s-***@nospam.nospamwrote in message
news:ee**************@TK2MSFTNGP05.phx.gbl...
I'm not sure where I should be placing the code that creates my literal
controls. They are rendering but AFTER the close of the HTML tag.

I've tried Load, Init, PreLoad, PreInit, PreRender and get the same result
each time:

Example code:

Controls.Add(New LiteralControl("<div>"))
Dim lblItem As New Label
lblItem.Text = ("<p>") & item.Element("title").Value
lblItem.Font.Bold = True
lblItem.Style.Item("display") = "block"
lblItem.Style.Item("width") = "350px"
Controls.Add(lblItem)

Jul 14 '08 #3
I wanted to produce html output within the <body><form and </form></body>,
but instead was getting all my controls in the output, following the
</html>.

The problem is solved now, though. I did add a panel control at design-time
and then added my literals to that at run-time.

Thanks.
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ux**************@TK2MSFTNGP04.phx.gbl...
Can you show the html output you want to produce and what is the code
actually producing?

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Scott M." <s-***@nospam.nospamwrote in message
news:ee**************@TK2MSFTNGP05.phx.gbl...
>I'm not sure where I should be placing the code that creates my literal
controls. They are rendering but AFTER the close of the HTML tag.

I've tried Load, Init, PreLoad, PreInit, PreRender and get the same
result each time:

Example code:

Controls.Add(New LiteralControl("<div>"))
Dim lblItem As New Label
lblItem.Text = ("<p>") & item.Element("title").Value
lblItem.Font.Bold = True
lblItem.Style.Item("display") = "block"
lblItem.Style.Item("width") = "350px"
Controls.Add(lblItem)


Jul 14 '08 #4
Ok. Just note that there is a server control specially made for that
purpose. It is called PlaceHolder.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Scott M." <s-***@nospam.nospamwrote in message
news:eO**************@TK2MSFTNGP03.phx.gbl...
>I wanted to produce html output within the <body><form and </form></body>,
but instead was getting all my controls in the output, following the
</html>.

The problem is solved now, though. I did add a panel control at
design-time and then added my literals to that at run-time.

Thanks.
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ux**************@TK2MSFTNGP04.phx.gbl...
>Can you show the html output you want to produce and what is the code
actually producing?

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Scott M." <s-***@nospam.nospamwrote in message
news:ee**************@TK2MSFTNGP05.phx.gbl...
>>I'm not sure where I should be placing the code that creates my literal
controls. They are rendering but AFTER the close of the HTML tag.

I've tried Load, Init, PreLoad, PreInit, PreRender and get the same
result each time:

Example code:

Controls.Add(New LiteralControl("<div>"))
Dim lblItem As New Label
lblItem.Text = ("<p>") & item.Element("title").Value
lblItem.Font.Bold = True
lblItem.Style.Item("display") = "block"
lblItem.Style.Item("width") = "350px"
Controls.Add(lblItem)



Jul 14 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Thomas Stegen | last post by:
I have written a code generator. To be more specific it is a code generator generator. As in a generator that generates code generators. If you run the generator on its own source code you get a...
5
by: Ricardo | last post by:
I'm buiding a class that pick the files in a directory and shows in the browser the links to download these files... But i have to create the hyperlinks, and that part is not working... I do the...
20
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
4
by: nathan.cutmore | last post by:
BACKGROUND: I have a bound datagrid with the following code - <asp:datagrid id="dgla" OnItemCommand="declareDatagrid"> .... <Columns> <ItemTemplate> <asp:Literal id="lbOnLoan" Runat="server"...
6
by: Joe | last post by:
I know that the Literal control will not render a <span> tag so I can not format its text. Other than this, what is the difference betwen the Literal control and the LiteralControl Control? How...
5
by: Mark A. Sam | last post by:
Hello, I am trying to use a literal control to past test onto a page from several buttons, so that each button displays something different. The problem I am encountering is that the text wraps...
5
by: paul.hester | last post by:
Hi all, I have a custom control with an overridden Render method. Inside this method I'm rendering each control in its collection using their RenderControl method. However, I'm running into a...
0
by: Hetal | last post by:
Hi, I have been working on creating a dynamic table with controls on a ASP.NET webpage and i have been using literal controls to do that. The issue that i am facing is, when i have the Start and...
1
by: Hetal | last post by:
Hi, I have been working on creating a dynamic table with controls on a ASP.NET webpage and i have been using literal controls to do that. The issue that i am facing is, when i have the Start and...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.