Textboxes Different in Appearance?

Hi everyone,

I have two textboxes, textbox1 and textbox2.

Initially, textbox1 is enabled and textbox2 is disabled (Enabled="False" BackColor="#CDC9C9").

Now, in code, when I programatically set textbox2 to be enabled and the backcolor to Drawing.Color.Transparent, I am getting a different look on the textbox.

I want to make sure that the appearance of textbox2 would be the same as of textbox1.

Help. Thanks.

-1
BatutaBunsing
5/5/2009 12:59:06 AM
asp.net.web-forms 93655 articles. 3 followers. Follow

2 Replies
783 Views

Similar Articles

[PageSpeed] 20

Hi There,

When you set BackColor to the TextBox, it actually overwrite the default TextBox style. In order to restore to original style you can set the style manually.

Example:

Set BorderColor, BorderWidth, BackColor. You can also use css style to do this by just changing the css class name.

TextBox1.Enabled = true;

TextBox1.BorderWidth = new Unit(1);

TextBox1.BorderColor = System.Drawing.Color.LightGray;

TextBox1.BackColor = System.Drawing.Color.White;

Hope it helps!


DC517
Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved.
-1
d4dennis
5/5/2009 1:16:05 AM

You will need to apply same values for Enabled, BackColor and any other properties


Bind GridView to Dynamically created DataTable | Bind DataTable to DropDownList

My Blog
-1
shahed
5/5/2009 7:03:41 AM
Reply:

Similar Artilces:

HTML textboxes appear but not web form textboxes
Hi all, I'm new to all this VS.net and I tested it by creating a new project, and clicking and dragging an asp textbox onto the aspx page. Upon clicking "Build and Browse" the asp textbox does not appear at all. So I double checked, and yeah, Visible was set to true. So I tried clicking and dragging a normal textbox and strangely, the html textbox does appear on the screen. Please help on how I can make the ASP textbox appear. I constructed a webform entirely of ASP textboxes and ASP buttons and nothing on the page appears. Is there anything I need to add/remove on the con...

C#.NET WEB APPLICATION
hei guys, i need help on my application, i'm using C#.NET as front-ed and SQL as back-end, aside from a datagrid, i want to display my data using textboxes and not a datagrid, i can do it using Visual Basic 6 but since i'm a newbee at C#.NET i don't know how to do it, specially the codes, can anyone help me with it? thank you in advance! If you are doing windows development, i would suggest using 'DataForm wizard' (Use Solution Explorer-->Rightclick project-->Add new Item-->New DataForm). It will guide you through steps. If you are doing web apps. Use quickstart to learn them. h...

can someone one give me difference between web form and mobile web form and which or where or when i'm using the forms?
thanks Marc Hi Marc, Based on my understanding, you want to know the differences between the ASP.NET web application and ASP.NET mobile web application. If I have misunderstood you, please feel free to let me know. The ASP.NET forms are used to develop the ASP.NET pages for desktop browsers and The ASP.NET mobile forms are used to develop the ASP.NET pages for mobile device browsers. When we create the ASP.NET mobile web forms pages, we can use nearly all the features of ASP.NET. But there are a couple of compatibility issues: Error Handling and Reporting. Tracing. Using Redi...

Implementing .Net Form into an APS.net web form, can this be done
I am new here, but have been searching for a while, and may not have the correct lingo to find what I am looking for.  I am tasked with implementing a .exe application that was writen vb6 then converted to .net into a new website my team is developing. The idea is to put each of the 3 different forms in this .exe application of 3 different .aspx pages. I have attempted multiple things to get this into the page and even started to just rewrite it as an ASP.net web form, but even then I can't reuse any of the code since the System.Web.UI.Page doesn't inherit the sa...

Troubleshoot Web Service; Ajax AutoComplete events do not appear to not fire; Ajax web service appears to not work. .NET
Folks, I had the situation that Ajax AutoComplete events in the web service did not fire after I copied a project out of a folder, renamed it and moved it to a server. The fix was hard to find but easy to solve. I had some web service modules in an ASMX file that provided AutoComplete entries -- i.e., after the user keys in 2 or 3 characters, the list of possible entries with those leading characters is displayed for the user to select. To solve the problem, look at the web service's directive, not the code-behind or the ASMX designer.  Do a right-mouse-click...

Difference between mobile web applications and standard web applications + mobile web forms in them ?
I have a series of existing sites, but I need to make a PPC version of them (there already is one, but it uses standard web forms). Since the code-behind looks a lot in the PC and in the PPC version, I'd like both versions to use the same files for the code. I'm left with 2 options : - either create a new mobile web application for each existing web application, and put all the code behind in .dlls which I'll call from each page ; - or, if this is possible (and I'd rather do it), simply add mobile web forms to the existing web applications and redirect at login to the appropriate ve...

windows forms in vb .net into web forms
we are creating a database driven website as part of our project. currently we have forms connecting to the database created in visual basic. these windows forms we need to convert into web forms which are asp .net compatible. can u give me an answer or show me a way. Hi, because of the difference in nature between web and win applications you'll need to reimplement at least the UI part. If you have a multitiered application in which the busines logic and data access are in different parts/assemblies you can reuse them. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Wor...

About difference in execution between Windows forms, and web forms?
One interviewer has asked me the following questionHow the execution differs from windows application to web application?Means,How windows forms will be executed?How web forms will be executed?and, what is the difference in execution between them?Ashok kumar  kak_mca wrote:One interviewer has asked me the following questionHow the execution differs from windows application to web application?And what was your answer to that question? Alister  kak_mca wrote:One interviewer has asked me the following questionHow the execution differs from windows application to web applicati...

So confused at the difference of DataGridViews between Windows Forms and Web Forms
I'm trying to do a really simple task with a datagridview on a Windows Form and it is hugely difficult and leaves me feeling quite inadequate. I'll do the same with asp.NET for a web application and it's so easy.  Is it me or are the development teams for these two products from completely different camps? I want to make a DataGridView that will allow Edit and Delete via Buttons and not the generic click on the row and edit stuff default as that is not what the client expects. A tutorial might help me.  Thanks. Geoff Have you tried using the DetailsView or FormView? Ther...

Searching for a form name (present in a different web form)
Searching for a form name (present in a different web form) I have a web form (webform1) where all available forms are displayed. Another web form (webform2) where i have few or no alerts for one or each or none of the forms on the webform1. I have to place an icon or something to the next of the forms on webform1 to notify users about the alerts. What is the possible way to do this. Please give some suggestions. Thanks Hey, Not quite sure what you are looking for... could you explain in more depth, or post some code to help look at it? BrianBrian"Trust in the Lord and d...

validate Textbox in Web User Control from web form?
ASP.NET 2.0 I have a web user control that contains a textbox.  I need to add some validation (like requiredfieldvalidator, comparevalidator, etc). I would normally add the validator to my web user control by placing the validator next to my textbox.  However, I need the validation message somewhere else on my web form, not near the user control. So how would I associate a validation control on my web form with the text box inside my web user control?  Can this be done; any alternatives out there? Thanks!   The error message should occur wherever you place the vali...

.Net Web Form & Web Service Deployment
Hi all I have written some test web services and some web form applications and deployed them to my IIS. That's fine but I now want to deploy them to my real IIS server. I have created an msi for each but the problem is I seem to only be able to deploy to the default web site. Our default web site is turned off and instead we use several other sites. Does anybody happen to if Powerbuilder 11 supports non default web sites? If not do I need to hack the msi and if so can anybody suggest a suitable tool. I have Orca but it's not very friendly. Unless of course I knew exactly w...

Web forms and mobile web forms
Hey everyone, I am looking to develope a web site that depending on the device connecting to it, it will display a certain page. In this case im looking to create a web and wap version of the same project. I have the Web forms version finished using ASP.NET and C# and I am wondering how to create the mobile web form and incorporate it in the project. In the project folder, can I just add a mobile web??? But what about displaying device specific pages?? Cheers -Dudach Yes, you can add mobile web forms and controls to your Web Application project. No problem. For device/br...

How to Make Web Forms from other Web Forms
In putting together an ASP.NET application for a biz application, we have come to the point where there are three different types of basic forms which have, for the most part, been perfected. Now its is a matter of cloning those forms for various uses and modifying or adding code to suit the particular need. Copy and paste works OK, but there is a lot of changing of certain words, etc. Is there a way in ASP.NET to take these basic forms, turn them into classes or templates, create forms from them, then add or overwrite code? ? (Anybody who is a Vis Fox Pro programmer would know imme...

Convert Web.UI.WebControls.TextBox to Windows.Forms.TextBox
 I am trying to take user selected text from a textbox and save that portion to a string value, but the only method I have found involves using the System.Windows.Forms namespace and since I am using the FindControl method to pull the text box control from a form view, it throws a "can not convert webcontrol to form" error at me.  So far I have been able to bring the form view controls into the code behind page, but I still have the problem of grabbing the selected text.  Here is my code:         Dim textBox As System.Web.UI.WebCont...