• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 578
  • Last Modified:

Dynamic Textbox Style/Event

I am dynamically creating textboxes in my ASP.NET page using VB.  How do I change the background color, borderstyle, and add the OnKeyUp event when creating the textboxes dynamically?
0
FIM2003
Asked:
FIM2003
  • 2
  • 2
1 Solution
 
praneethaCommented:
you can use

TextBox1.Attributes.Add("style","background-color:Red");

same way for border style...

TextBox1.Attributes.Add("OnKeyUp","javascript fn");
0
 
FIM2003Author Commented:
those work, however, when I set the background color and border, they overwrite each other


txtTextBox.Attributes.Add("style","background-color:'#C0C0C0'")
txtTextBox.Attributes.Add("style","border:None")

The border style overwrites the background color and vice-versa when the border is before the background line.
0
 
praneethaCommented:
txtTextBox.Attributes.Add("style","background-color:'#C0C0C0' ; border:None")

try that
0
 
FIM2003Author Commented:
Thanks praneetha
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now