Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Literal control won't expand

Reply
Thread Tools

Literal control won't expand

 
 
Mark A. Sam
Guest
Posts: n/a
 
      06-28-2006
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 = "<aspanel 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.</aspanel>"

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







 
Reply With Quote
 
 
 
 
Mark A. Sam
Guest
Posts: n/a
 
      06-28-2006
This has nothing to do with the literal control. Its just another
unexplainable issue with a Microsoft product. Enough said.


 
Reply With Quote
 
 
 
 
Vadivel Kumar
Guest
Posts: n/a
 
      06-28-2006
IMHO, 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 = "<aspanel 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.</aspanel>"
>
> 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
>
>
>
>
>
>
>

 
Reply With Quote
 
Mark A. Sam
Guest
Posts: n/a
 
      06-28-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> IMHO, 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 = "<aspanel 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.</aspanel>"
>>
>> 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
>>
>>
>>
>>
>>
>>


 
Reply With Quote
 
Vadivel Kumar
Guest
Posts: n/a
 
      06-28-2006
Anyways, Did you understand the code and tried to solve the problem?

--
Vadivel Kumar
http://www.vadivelk.net
http://www.velocityreviews.com/forums/(E-Mail Removed) (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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> IMHO, 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 = "<aspanel 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.</aspanel>"
>>>
>>> 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
>>>
>>>
>>>
>>>
>>>
>>>

>

 
Reply With Quote
 
Mark A. Sam
Guest
Posts: n/a
 
      06-28-2006

"Vadivel Kumar" <(E-Mail Removed)> wrote in message
news:%23ve%(E-Mail Removed)...
> Anyways, Did you understand the code and tried to solve the problem?


No, I solved it another way. I placed a literal control inside of a panel
control, then sized the width of the panel. I then applied code to the
literal control like this:

Protected Sub btnIntro_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnIntro.Click

Dim str As String

str = "<span style='font-size: 14pt'>"""

str = str & "Promote Ministries is an independent ministry with a mission of
reaching young people for Jesus Christ. We are a group of servants called
together into this ministry, to be independent of a Church or other
organization, where politics are apt to bind our hands and prevent us from
serving to our fullest capacity. We don't feel that all ministry should be
carried out this way, but that we are called to this format. </br></br>"

str = str & "If you feel called to work in Youth Ministry, we would like to
talk to you, however, know that a lot will be required of you. You will be
asked to make a commitment to focus on the work of the ministry and put if
ahead of your other interests, including family and friends. You will be
asked, in other words to put God's work first (Luke 18:22, Luke 9:59-62,
Matthew 10:35-37). </br>"

str = str & "</span>"

LitMessage.Text = str

End Sub

I have other buttons which apply text to the literal control and this works
perfectly.

The problem is typing or applying text inside of a table. Visual Web
Developer Express doesn't like it. So it requires another container,
specifically a panel to enable you to control the width of the text area.

Thank you for your responses.

God Bless,

Mark


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What's the Difference between an asp:Literal control and an asp:Localize control? netcodedevil@gmail.com ASP .Net Web Controls 0 09-26-2007 11:12 AM
How to put Expand all and Collapse all button for a asp.net TreeView Control ? vivek ASP .Net 2 06-14-2007 05:24 AM
asp.net 2.0 treeview control expand with select Stephen ASP .Net 2 08-24-2005 03:07 PM
What's wrong with rpc-literal? Why use doc-literal? Anonieko Ramos ASP .Net Web Services 0 09-27-2004 09:06 AM
urgent please : treeview control expand collapse Gönen EREN ASP .Net 4 08-16-2003 06:15 PM



Advertisments