Click here to Skip to main content
15,879,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how do i change TextBox property from single line to multi line?

TextBox name = (TextBox)(e.Item.Cells[1].Controls[0]);
Posted

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.aspx[^]


Pay attention to the TextMode property, as well as Rows if you want to preset the number of rows
 
Share this answer
 
v2
Comments
sahabiswarup 3-Nov-11 3:52am    
i have already mentioned:
using System.Web.UI.WebControls;
but still getting that following error.
'System.Web.UI.WebControls.TextBox' does not contain a definition for 'Multiline' and no extension method 'Multiline' accepting a first argument of type 'System.Web.UI.WebControls.TextBox' could be found (are you missing a using directive or an assembly reference?)
UJimbo 3-Nov-11 4:22am    
Take a look at your question above, you have not mentioned this was about System.Web.UI.WebControls. It is only flagged as C# and my mind reading skills are a bit rusty
By using

textBox1.Multiline = true;


you can control the Multiline property of textbox

or check out this

http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.aspx[^]
 
Share this answer
 
u can use TextMode property,
if u want to change the at runtime then u can use as:
C#
TextBox1.TextMode = TextBoxMode.MultiLine;
 
Share this answer
 
v2
If it is windows application then use Multiline Property of textbox
C#
textBox1.Multiline = true;


if web application then use TextMode property
C#
TextBox1.TextMode=TextBoxMode.MultiLine;
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900