By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,494 Members | 1,079 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,494 IT Pros & Developers. It's quick & easy.

Placing control tag text in a multiline TextBox

P: n/a
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.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Jan 3 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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" <nj********@hotmail.comwrote in message
news:u6**************@TK2MSFTNGP06.phx.gbl...
>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.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Jan 3 '08 #2

P: n/a
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
nj********@hotmail.com
http://www.nathansokalski.com/

"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:Oo**************@TK2MSFTNGP05.phx.gbl...
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" <nj********@hotmail.comwrote in message
news:u6**************@TK2MSFTNGP06.phx.gbl...
>>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.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/


Jan 3 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.