Solved

Dynamic Textbox Style/Event

Posted on 2004-10-14
4
569 Views
Last Modified: 2012-06-27
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
Comment
Question by:FIM2003
  • 2
  • 2
4 Comments
 
LVL 15

Expert Comment

by:praneetha
ID: 12309839
you can use

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

same way for border style...

TextBox1.Attributes.Add("OnKeyUp","javascript fn");
0
 

Author Comment

by:FIM2003
ID: 12309973
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
 
LVL 15

Accepted Solution

by:
praneetha earned 250 total points
ID: 12310040
txtTextBox.Attributes.Add("style","background-color:'#C0C0C0' ; border:None")

try that
0
 

Author Comment

by:FIM2003
ID: 12310908
Thanks praneetha
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now