Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3278092
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:26:34+00:00 2026-05-17T19:26:34+00:00

i have a asp:TextBox control on the page. i’m setting it to a TextMode=MultiLine,

  • 0

i have a asp:TextBox control on the page. i’m setting it to a TextMode=”MultiLine”, I am not setting a number of rows or columns. I am setting a width and height in CSS for the control.

asp.net is still adding, what i assume is a default, rows and cols attributes on the rendered control. cols=”20″ and rows=”2″ this isnt an issue in any sane, browser, but in IE the CSS height is ignored and only 2 rows of space is show.

How can I prevent these attributes from showing up on the rendered control?

Edit:

This is an issue only in IE8 in compatibility mode, IE7 and IE6. I’m not worried about IE6, but IE7 needs to work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:26:34+00:00Added an answer on May 17, 2026 at 7:26 pm

    External CSS (do not mix inline and external CSS):

    .myTextBox
    {
        height: 40px; 
        width: 220px;
    }
    
    <asp:TextBox ID="TextBox1" CssClass="myTextBox" runat="server"></asp:TextBox>
    

    Note that a height of 100% will give you a default single line height – basically no effect. If you want multi-line, then simply use pixels in the CSS.

    Generated markup:

    <input name="TextBox1" type="text" id="TextBox1" class="myTextBox" />
    

    The CSS height setting works just fine to give a double row effect.

    Best approach here is to test it in its most basic form and progressively enhance it across the different browsers.

    UPDATE

    ASP.NET is using the CSS values instead of setting the Rows and Columns equivalents. However, it’s still working correctly in FF 3.6 and IE8 (in compatibility mode). To supress these attributes I think you would may have to create a custom control inheriting from TextBox and tweak the render method. Not sure, but you could also try removing these attributes with JS.

    A multiline textbox is actually a HTML <textarea> tag:

    http://www.w3schools.com/TAGS/tag_textarea.asp

    .myTextBox
    {
        height: 100px; 
        width: 220px;
    }
    

    HTML rendered in IE8 compatibility mode:

    <textarea name="TextBox1" rows="2" cols="20" id="TextBox1" class="myTextBox">
    

    I can confirm the the multiline functionality is correct in IE8 compatibility mode.

    HTML rendered in Firefox:

    <textarea name="TextBox1" rows="2" cols="20" id="TextBox1" class="myTextBox">
    

    Interestingly, the rows and columns are set to “0” in the properties window of VS 2010 yet still appear in the markup, set to “2” and “20”, respectively! These links may help you:

    http://dotnet.itags.org/webcontrols/95106/

    http://forums.asp.net/t/944368.aspx?Removing+Attributes+on+Rendering+WebControllink text

    NOTE: If your doctype is XHTML 1.0 Transitional, the rows and cols attributes of a textarea are required. So, you may find that after going to all the trouble of creating a custom control to eliminate these attributes, that the containing page will not validate.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I have a regular textbox in a UpdatePanel (not an ASP.NET control) with
I have a asp Textbox control in my .aspx page. I have a .cs
I have the following control: <asp:TextBox ID=textbox1 runat=server Width=95px MaxLength=6 /> which i would
I have an asp.net TextBox control on my page and a search button whenever
I have three TextBox controls on the page <asp:TextBox ID=TextBox1 runat=server AutoPostBack=True OnTextChanged=TextBox_TextChanged TabIndex=1>
I'm creating a login page. I want to create ASP.NET TextBox controls that have
I have an asp.net textbox and a MaskedEditExtender control attached to it. The textbox
I have user control named DateTimeUC which has two textboxes on its markup: <asp:TextBox
I have an ASP.Net web user control that contains a TextBox and a calendar
I have a hidden TextBox control on my page that updates a span tag

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.