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]);

Pay attention to the TextMode property, as well as Rows if you want to preset the number of rows
Share this answer
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[^]
Share this answer
u can use TextMode property,
if u want to change the at runtime then u can use as:
TextBox1.TextMode = TextBoxMode.MultiLine;
Share this answer
If it is windows application then use Multiline Property of textbox
textBox1.Multiline = true;

if web application then use TextMode property
Share this answer

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