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

  • Home
  • SEARCH
  • 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 8125935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:59:02+00:00 2026-06-06T06:59:02+00:00

Possible Duplicate: Default textbox border-style and width I have some TextBox on my page

  • 0

Possible Duplicate:
Default textbox border-style and width

I have some TextBox on my page that should be red bordered from the code behind.
But the Multiline TextBox that present a vertica scrollbar, does not show the border from its side.

Here is my code that set the border:

            foreach (var str in idsRequired)
            {
                var ctrl = (WebControl)FindControl(str);
                if (ctrl != null)
                    ctrl.Style.Add(HtmlTextWriterStyle.BorderColor, "red");
            }

I get controls by ID and the set theyr border.
Question is: how can i correctly border all the TextBox control?

EDIT

I finnaly end up with setting the border style to 2px and the right border appear. As you can see here:

enter image description here

How can you explain this?

  • 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-06-06T06:59:04+00:00Added an answer on June 6, 2026 at 6:59 am

    As an advice, try to delegate the style of your controls to CSS files or ASP.Net themes. Why? Because you usually would want to reuse the same style across your website and imagine when you want to change the style again (which in a real application happens a lot), you would have to edit your code directly potentially introducing some undesired bugs, so avoid this and just separate your design from your code

    • You could declare the style in a CSS file and just import it to your page:

      Using CSS

         .txtWithRedBorder
        {
      border-style: solid;
      border-color: #FF0000;
      

      }

      In your control

        <asp:TextBox runat="server" Rows="5" TextMode="MultiLine" CssClass="txtWithRedBorder" />
      

      Remember to place your CSS file under the Theme folder and add the following directive to the page to import automatically all the CSS files to your page

         <%@ Page Theme="Theme1"....
      
    • Or you could create an ASP.Net theme to accomplish the same effect:

      <%@ Page Theme="Theme1"....
      
      <asp:TextBox runat="server" Rows="5" SkinID="someSkinID" TextMode="MultiLine" />
      

      In your skin file:

      <asp:TextBox runat="server" BorderColor="Red" BorderStyle="Solid" SkinID="someSkinID" />
      

      Remember you need to specify the theme:

      enter image description here

      And this is the result

      enter image description here

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

Sidebar

Related Questions

Possible Duplicate: Is it possible to skip parameters that have default values in a
Possible Duplicate: Stop default hashtag behavior with jquery I have some jquery code on
Possible Duplicate: Concatenate Two NSDate String values Just confused that is there any default
Possible Duplicate: “Least Astonishment” in Python: The Mutable Default Argument I'm finding that dictionary
Possible Duplicate: .Net Process.Start default directory? I have a C# application, mono to be
Possible Duplicate: break in a case with return.. and for default If I have
Possible Duplicate: Override default php function Is there a way to detect that a
Possible Duplicate: How to launch the default (native) application for a given file from
Possible Duplicate: How do you give a C# Auto-Property a default value? I have
Possible Duplicate: Default sort-ordering in MySQL (ALTER TABLE … ORDER BY …;) I have

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.