Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Mandatory prefix on asp.net form

Posted on 2013-11-13
2
Medium Priority
?
367 Views
Last Modified: 2013-11-15
I have a textbox receiving input, and I want to both display a single prefix character, but also prevent the user from erasing it in the textbox.  I'm more familiar with win form development, and know how I'd handle it there.
Is that going to be too complicated in asp.net?  I could simply include it myself, stripping it off if it's included, so I didn't want to go for any complex solution.
0
Comment
Question by:sirbounty
[X]
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
2 Comments
 
LVL 22

Accepted Solution

by:
ambience earned 1000 total points
ID: 39647563
There are several ways of doing that in ASP.NET but in every case you resort to client-side javascript to intercept key-press events to modify behavior of the control.

Since jQuery is nicely supported by ASP.NET I would recommend to take a look at any "masked input" plugin for jQuery, or even standalone code. Google for "jquery masked input" and check the first few hits - digitalBash has a nice example.

There is a good chance someone has a masked input server-side control for use in WebForms, but you can easily write a UserControl to wrap everything in one reusable unit.

ASP MVC by default has jQuery integrated so adding a plugin shouldnt be a difficult task.
0
 
LVL 67

Author Closing Comment

by:sirbounty
ID: 39651141
Been a while since I've played with jquery...I'll keep that in the back of my mind.
Thanks for the pointers.
0

Featured Post

Understanding Linux Permissions

Linux for beginners: How to view the permissions associated with files and directories and also how you can change them.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

721 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