Re: Literal control won't expand [You should read this]
- From: Vadivel Kumar <vadivelk@xxxxxxxxxxxx>
- Date: Wed, 28 Jun 2006 17:53:42 +0530
Anyways, Did you understand the code and tried to solve the problem?
--
Vadivel Kumar
http://www.vadivelk.net
vadi@xxxxxxxxxxxxxxxxxxx (remove "online.")
Mark A. Sam wrote:
Vadivel,.
Really it doesn't make sense. According to information I had, a literal accepts html. So it would be my understanding that if I assigned it code directly from the webpage, it would know how to interpret it. It was an error in my thinking.
Here is the problem. I type directly onto the webpage. I typed a line of text across the page and let it wrap to the second line. Then I opened the source to look at the html and went back into designview. The line of text I entered was now unched up on the left side of the page. This also happens usually when I type directly into tables, then I have to add Panel to force the text across the page or cell. It is difficult to know how controls are to work, becuase normal things don't act normally. This is true of all Microsoft products. It's one goofy thing after another. It's frustrating. ;)
God Bless,
Mark
"Vadivel Kumar" <vadivelk@xxxxxxxxxxxx> wrote in message news:OKvNvcpmGHA.4716@xxxxxxxxxxxxxxxxxxxxxxxIMHO, I can say your understanding towards the ASP.NET concepts are to be slightly reconsidered.
This is not the right way of placing an Panel (or any other server control) inside a server control. I think, MS doesn't make any thing that wont make sense, because the code you pasted here works properly as per its nature, but not as per your expectation.
Basically, you have to understand that the code is first executed in the server side and sent to the client, so as per your code what happens is the "str" will compiled to sent as a "normal text" to the LitMessage control's text property. So you would end up in seeing the text rather then the panel control.
The right code would look similar to this (this code is in C#),
Panel objPanel = new Panel();
Literal objLiteral = new Literal("This is a test1");
objPanel.Controls.Add(objLiteral);
// I am assuming LitMessage is any other webcontrol that is
// already placed in the page.
LitMessage.Controls.Add (objPanel);
Is that makes sense? If you could understand the code, you can see the cleanliness and how it is more well-formed.
Let me know if you need further information.
-
Vadivel Kumar
http://vadivelk.net
Mark A. Sam wrote: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 with line breaks, as well as trying to place a panel onto the page through the literal, to force the width, but no success.
Dim str As String
str = "<asp:Panel ID='Panel1' runat='server' BorderColor='Black' BorderWidth='4px' Height='25px' Style='position: static' Width='540px'>"
str = str & "This is a test1. This is a test2. This is a test3. This is a test4. This is a test5.</asp:Panel>"
LitMessage.Text = str
It displayed the text, but not the panel.
Does anyone have any idea what the problem is, or is it just another Microsoft thang?
Thank you and God Bless,
Mark A. Sam
- Follow-Ups:
- Re: Literal control won't expand [You should read this]
- From: Mark A. Sam
- Re: Literal control won't expand [You should read this]
- References:
- Literal control won't expand
- From: Mark A. Sam
- Re: Literal control won't expand [You should read this]
- From: Vadivel Kumar
- Re: Literal control won't expand [You should read this]
- From: Mark A. Sam
- Literal control won't expand
- Prev by Date: Re: uploading multiple file in a folder
- Next by Date: Re: How to add extra field(In stock/Out of stock) to a DropDownList ?
- Previous by thread: Re: Literal control won't expand [You should read this]
- Next by thread: Re: Literal control won't expand [You should read this]
- Index(es):
Relevant Pages
|