HighTechTalks DotNet Forums  

Placing control tag text in a multiline TextBox

ASP.net ASP.net discussions (microsoft.public.dotnet.framework.aspnet)


Discuss Placing control tag text in a multiline TextBox in the ASP.net forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Nathan Sokalski
 
Posts: n/a

Default Placing control tag text in a multiline TextBox - 01-02-2008 , 08:02 PM






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
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/



Reply With Quote
  #2  
Old   
Eliyahu Goldin
 
Posts: n/a

Default Re: Placing control tag text in a multiline TextBox - 01-03-2008 , 02:31 AM






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" <njsokalski (AT) hotmail (DOT) com> wrote

Quote:
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
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/




Reply With Quote
  #3  
Old   
Nathan Sokalski
 
Posts: n/a

Default Re: Placing control tag text in a multiline TextBox - 01-03-2008 , 11:42 AM



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
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/

"Eliyahu Goldin" <REMOVEALLCAPITALSeEgGoldDinN (AT) mMvVpPsS (DOT) org> wrote in
message news:OoRDRNeTIHA.2000 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
Quote:
Try something like
&lt;NJS:MyCustomControl ID="MyCtrl1" runat="server"/

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


"Nathan Sokalski" <njsokalski (AT) hotmail (DOT) com> wrote in message
news:u6V3qyaTIHA.4360 (AT) TK2MSFTNGP06 (DOT) 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
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/






Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.