473,809 Members | 2,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(Ne w LiteralControl( "<div>"))
Dim lblItem As New Label
lblItem.Text = ("<p>") & item.Element("t itle").Value
lblItem.Font.Bo ld = True
lblItem.Style.I tem("display") = "block"
lblItem.Style.I tem("width") = "350px"
Controls.Add(lb lItem)
Jul 13 '08 #1
4 1461
--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.contr ols.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.nosp amwrote:
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(Ne w LiteralControl( "<div>"))
Dim lblItem As New Label
lblItem.Text = ("<p>") & item.Element("t itle").Value
lblItem.Font.Bo ld = True
lblItem.Style.I tem("display") = "block"
lblItem.Style.I tem("width") = "350px"
Controls.Add(lb lItem)
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.nosp amwrote in message
news:ee******** ******@TK2MSFTN GP05.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(Ne w LiteralControl( "<div>"))
Dim lblItem As New Label
lblItem.Text = ("<p>") & item.Element("t itle").Value
lblItem.Font.Bo ld = True
lblItem.Style.I tem("display") = "block"
lblItem.Style.I tem("width") = "350px"
Controls.Add(lb lItem)

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.orgwro te in
message news:ux******** ******@TK2MSFTN GP04.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.nosp amwrote in message
news:ee******** ******@TK2MSFTN GP05.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(N ew LiteralControl( "<div>"))
Dim lblItem As New Label
lblItem.Text = ("<p>") & item.Element("t itle").Value
lblItem.Font.B old = True
lblItem.Style. Item("display") = "block"
lblItem.Style. Item("width") = "350px"
Controls.Add(l blItem)


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.nosp amwrote in message
news:eO******** ******@TK2MSFTN GP03.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.orgwro te in
message news:ux******** ******@TK2MSFTN GP04.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.nosp amwrote in message
news:ee******* *******@TK2MSFT NGP05.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.Tex t = ("<p>") & item.Element("t itle").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
2390
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 code generator generator code generator. If you run it on some other non-generator code you get a code generator generator generator. Watch your bracketisation in all that. The idea is to generate code which generate code which looks exactly like...
5
1792
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 folow in the page_Load: DirectoryInfo dir = new DirectoryInfo(@"e:\shared files"); FileInfo files = dir.GetFiles(); foreach(FileInfo file in files)
20
5667
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 client-side HTML, CSS, etc. What I want to do is somehow insert a *server control* into the , then set the server control's properties at runtime.
4
2210
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" /> </ItemTemplate> <FooterTemplate>
6
6940
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 about a LiteralControl and a Label? Other than the lack of being able to format the Literal control's text, I don't see much of a difference in the documentation. TIA, --
5
2859
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 according to the width of the literal, which is the width then it is put on the page. The other day I played with this and had no problem. I assigned the text to the literal and it went onto the page as it should have. I tried using html tags...
5
2345
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 problem in this scenario: <myprefix:mycontrol runat="server"> <%= SomeVariable %> </myprefix:mycontrol>
0
1006
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 End tag as 2 different literal controls, they do not seem to form a part of my table. Below is the example. 'This code works fine. ================
1
1655
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 End tag as 2 different literal controls, they do not seem to form a part of my table in the second scenario below. plhTMReview - Placeholder StartLiteral - String Variable
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10115
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7653
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3013
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.