Placing control tag text in a multiline TextBox

  • Thread starter Nathan Sokalski
  • Start date
N

Nathan Sokalski

I have a multiline TextBox that I want to display the text used to create a
control in an apsx file. I want each of these to be on a separate line in
the TextBox. The only way I know of to place things on separate lines in a
TextBox without doing it programmatically is the following:

<asp:TextBox ID="txtMultiLine" runat="server" TextMode="MultiLine">
Line 1
Line 2
Line 3
</asp:TextBox>

However, if I do something like the following:

<asp:TextBox ID="txtMultiLine" runat="server" TextMode="MultiLine">
<NJS:MyCustomControl ID="MyCtrl1" runat="server"/>
<NJS:MyCustomControl ID="MyCtrl2" runat="server"/>
<NJS:MyCustomControl ID="MyCtrl2" runat="server"/>
</asp:TextBox>

I receive a Parser Error that says:

Parser Error Message: The 'Text' property of 'asp:TextBox' does not allow
child objects.

Is there any way to avoid this problem without adding the text
programmatically? Thanks.
 
N

Nathan Sokalski

That was not my real concern here, my problem was that I cannot and line
breaks. Because the text is being placed inside a TextBox, the br tag will
not work. For the moment, I am simply adding the text in the Init event of
the Page, but that requires me to make sure all the "'s are added correctly,
which is a pain to do. Any ideas?
--
Nathan Sokalski
(e-mail address removed)
http://www.nathansokalski.com/

Eliyahu Goldin said:
Try something like
&lt;NJS:MyCustomControl ID="MyCtrl1" runat="server"/&gt;

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Nathan Sokalski said:
I have a multiline TextBox that I want to display the text used to create
a control in an apsx file. I want each of these to be on a separate line
in the TextBox. The only way I know of to place things on separate lines
in a TextBox without doing it programmatically is the following:

<asp:TextBox ID="txtMultiLine" runat="server" TextMode="MultiLine">
Line 1
Line 2
Line 3
</asp:TextBox>

However, if I do something like the following:

<asp:TextBox ID="txtMultiLine" runat="server" TextMode="MultiLine">
<NJS:MyCustomControl ID="MyCtrl1" runat="server"/>
<NJS:MyCustomControl ID="MyCtrl2" runat="server"/>
<NJS:MyCustomControl ID="MyCtrl2" runat="server"/>
</asp:TextBox>

I receive a Parser Error that says:

Parser Error Message: The 'Text' property of 'asp:TextBox' does not allow
child objects.

Is there any way to avoid this problem without adding the text
programmatically? Thanks.
 

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,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top