Start and End HTML tags as 2 different Literal controls.

  • Thread starter Thread starter Hetal
  • Start date Start date
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.
 
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.
 
Back
Top