Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Create a permanent textbox watermark in ASP.Net

Posted on 2010-09-23
4
885 Views
Last Modified: 2012-05-10
I am trying to create a web user control in ASP.Net that is a textbox with a permanent watermark positioned on the right hand side of the textbox. I want to be able to change the text on the watermark though a property of the user control.

To help make the example clearer, I want to use this textbox control for things like capturing percentages so the % symbol will be permanently displayed on the right hand-side of the textbox so it is clear to the user.

I have created something simple that works by having a label in a separate div that is absolutely positioned....however when I pull it into the main webpage the styles are overridden and it displays incorrectly.

Any thoughts?
0
Comment
Question by:bumbling_fool
  • 2
4 Comments
 
LVL 28

Accepted Solution

by:
strickdd earned 500 total points
ID: 33744715
This can be done with simple styling. Put a textbox inside a span tag, outside the textbox put the text to display, and finally remove the border style from the textbox and put it on the span.
0
 
LVL 8

Expert Comment

by:GeneralTackett
ID: 33746526
use css and place a transparent image positioned over the textbox the image will have a higher zorder than the text box and have your logo in the top right...
0
 
LVL 28

Expert Comment

by:strickdd
ID: 33746747
Doing the transparent image can provide multiple difficulties.

1) In a control you won't be able to specify the text to display on the image. this means a separate image for every text possible
2) Assuming you can dynamically generate this text or you have a specific list of displays that don't change the text will go behind the image and be hard to read if it is the length of the textbox.
3) Assuming the same as number 2, you may run into an issue where the user gets frustrated because he/she can't focus the textbox because he keeps clicking the image.
0
 

Author Comment

by:bumbling_fool
ID: 33747807
Nice and simple, thanks. Only issue I am still having is that the styles in the main page seem to override the styles in the web control. Any suggestions for this?
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

840 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