Start and End HTML tags as 2 different Literal controls.

H

Hetal

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
EndLiteral - String Variable
Literal() - Custom Function to create Literal control.

Function Literal(ByVal HTMLCode As String)
Dim litCode As New Literal
litCode.Text = HTMLCode
Literal = litCode
End Function

'This code works fine.
================
1. StartLiteral = "<tr> <td align=""center"" bgcolor=""#ffffff""
colspan=""2""> <font face=""Verdana, Arial, Helvetica"">Test Info"
EndLiteral = "</font> </td> </tr>"
plhTMReview.Controls.Add(Literal(StartLiteral))
plhTMReview.Controls.Add(Literal(EndLiteral))
=================

Both 1 and 2 above create a table row and table data for me


'But this code doesnt.
====================
1. StartLiteral = "<tr> <td align=""center"" bgcolor=""#ffffff""
colspan=""2"">"
plhTMRequest.Controls.Add(Literal(StartLiteral))

2. StartLiteral = "<font face=""Verdana, Arial, Helvetica"">Test
Info"
EndLiteral = "</font> <br>"
plhTMReview.Controls.Add(Literal(StartLiteral))
plhTMReview.Controls.Add(Literal(EndLiteral))

3. EndLiteral = "</td> </tr>"
plhTMRequest.Controls.Add(Literal(EndLiteral))
=====================

In the above case, 1 and 3 do not form a part of the markup but 2
does. Also, 2 is not created as a literal control of a table row/data
but it form a part of placeholder directly. When i right click on the
browser and view source code, it does not contain markup for 1 and 3.

Did i do something wrong? or am i overlooking something?

Thanks,
Hetal.
 
A

Anthony Jones

Hetal said:
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
EndLiteral - String Variable
Literal() - Custom Function to create Literal control.

Function Literal(ByVal HTMLCode As String)
Dim litCode As New Literal
litCode.Text = HTMLCode
Literal = litCode
End Function

'This code works fine.
================
1. StartLiteral = "<tr> <td align=""center"" bgcolor=""#ffffff""
colspan=""2""> <font face=""Verdana, Arial, Helvetica"">Test Info"
EndLiteral = "</font> </td> </tr>"
plhTMReview.Controls.Add(Literal(StartLiteral))
plhTMReview.Controls.Add(Literal(EndLiteral))
=================

Both 1 and 2 above create a table row and table data for me


'But this code doesnt.
====================
1. StartLiteral = "<tr> <td align=""center"" bgcolor=""#ffffff""
colspan=""2"">"
plhTMRequest.Controls.Add(Literal(StartLiteral))

2. StartLiteral = "<font face=""Verdana, Arial, Helvetica"">Test
Info"
EndLiteral = "</font> <br>"
plhTMReview.Controls.Add(Literal(StartLiteral))
plhTMReview.Controls.Add(Literal(EndLiteral))

3. EndLiteral = "</td> </tr>"
plhTMRequest.Controls.Add(Literal(EndLiteral))
=====================

In the above case, 1 and 3 do not form a part of the markup but 2
does. Also, 2 is not created as a literal control of a table row/data
but it form a part of placeholder directly. When i right click on the
browser and view source code, it does not contain markup for 1 and 3.

Did i do something wrong? or am i overlooking something?

Can't see anything wrong with what you have posted so far. You revealed
little og the plhTMRequest thing, the problem probably lies there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top