Go Back   CodingForums.com > :: Server side development > ASP.NET

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-18-2012, 07:37 PM   PM User | #1
nickHiebert
Regular Coder

 
Join Date: Oct 2009
Location: London, ON
Posts: 111
Thanks: 4
Thanked 0 Times in 0 Posts
nickHiebert is an unknown quantity at this point
How to create a textfield and extend it

Hi all,

I'm very new to ASP.NET programming and for a project at school we have to make a products maintenance page and for the description field I was wondering how you make the text field bigger. Not width but height. I tried putting in the height here.
Code:
<asp:TextBox ID="txtDescription" CssClass="TextBoxes" style="top: 130px; left: 656px; width: 140px; height: 50px;" 
            runat="server"></asp:TextBox>
But when I start typing into the description textfield it doesn't start at the top. Does anyone know how to create it so it can start at the top and continue to go down as I reach the end of the width of the textfield and onto the next line of the textfield?

I know how to do this in html using cols: 10px;

I just have no idea how you would do this in asp.net

Help would be great thanks!
nickHiebert is offline   Reply With Quote
Old 02-18-2012, 10:28 PM   PM User | #2
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
you need to change the text box to multi-line... you can do this several ways... there is the properties window, where the textbox is default single line... clicking the dropdown and changing it to multi-line adds this
Code:
<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine"></asp:TextBox>
my prefered method is to do pretty much everything in the code behind... I just feel it is better practice...
Code:
<!-- HTML section -->
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
...................................
// code behind
protected void Page_Load(object sender, EventArgs e)
        {
            TextBox1.TextMode = TextBoxMode.MultiLine;
        }
essentially doing this makes it so the textbox does not get rendered as an input, but as a textarea
__________________

I code C hash-tag .Net
Reference: W3C W3CWiki .Net Lib
Validate: html CSS
Debug: Chrome FireFox IE
alykins is offline   Reply With Quote
Reply

Bookmarks

Tags
asp.net, css, programming, textfields

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

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

Forum Jump


All times are GMT +1. The time now is 08:03 AM.


Advertisement
Log in to turn off these ads.