
Introduction
I was doing my usual programming, and one day, I was stuck in a big form that had too many textbox controls with many validations. I had a hard day putting all the things together on that page. I was a bit confused why Microsoft did not provide validations with the textbox itself. So, I have done that here. Now, nobody will have problems as I faced recently. Please send me any bug reports or suggestions for improving the textbox. This textbox is named as Zatak as I am a very big fan of the Zatak perfume. This textbox is like a simple textbox but it contains a lot of validation options which you can set using simple click and keystrokes. I am providing more details to you below. I am very thankful to Click2Install for providing me the initial framework. The source code is attached with the article and the zip file also contains a small demo of what the control can do.
Using the component
General Settings

There are different parts to the textbox control. The first part is the General Settings which are settings regarding the general validation control shown as above. It contains the focus on error, client script, validator display style, and method to show the validation. Currently, it supports text and icon. You can include other methods if you like.
Required Validation Settings

The first validation is required validation. If you want this textbox as required, then tick on the checkbox and write the message into the textbox which you want to show to the user.
Regular Expression Validation Settings

The second validation is regular expression validation. If you want this textbox to behave as some fixed type then select it from the combobox. You can give different settings as per the selection. Like for alphanumericwithspecialchar, you will get a textbox to enter special characters. For decimal, you will be prompted for digits after decimal. And there is one option Custom where you can provide your own regular expression.
Range Validation Settings

The third validation is range validation. If you want this textbox to include range validation, then tick this option. You can give different settings similar to the range validator.
Compare Validation Settings

The fourth validation is compare validation. If you want this textbox to include compare validation then tick this option. You can give different settings similar to the compare validator..
Custom Validation Settings

The fifth validation is custom validation. If you want to make a server function for validation, then implement the ServerValidate event.
Points of Interest
The first thing is sometimes there is memory problems in my Visual Studio 2005. I have put code to dispose the things that are allocated. But still if you find anything for improvements, then please let me know. All validations contain their own messages.
Currently there is a problem with the regular expression for date validation. I took it from a regular expression library site. It wass given for DD/MM/YYYY. But because I could not convert it to MM/DD/YYYY, I used another regular expression for MM/DD/YYYY. In that regular expression, 1/1/1 is not validated as date.
If you need anything regarding the code or its logic, please comment on this article.
If you find it useful or great then please rate this article a 5 :).
I have used the internal validators of ASP.NET 2.0 to build the validators behind the scenes.
And yes, do visit my Blog for upgrades and blogs about ASP.NET. I have recently started it and will post interesting article links, posts, snippets, and tools, and many other things that can save you time. So please subscribe to the RSS right now.
History
- Version 1.0 - Initial release.
| You must Sign In to use this message board. |
|
|
 |
|
 |
Hello
This is really a good control but Can't we display the error message on right end side of textbox?? Is it necessary to use the validation summary??
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Nope Rekha,
It's not necessary to do that. If you dont want to use validation summary, you can change the control code. I am sorry that I missed that function
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi Sir,
I Have a Problem in ZatakTexBox.
Error 1 Could not load file or assembly 'eWorld.UI, Version=2.0.2.2264, Culture=neutral, PublicKeyToken=24d65337282035f2' or one of its dependencies. The system cannot find the file specified.
Please help me
Regards, SR pael
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi,
Remove the eWorld.UI reference from the project. find eworld and remove all the lines from project.
e.g. <![CDATA[<%@ Register Assembly="eWorld.UI, Version=2.0.2.2264, Culture=neutral, PublicKeyToken=24d65337282035f2" Namespace="eWorld.UI" TagPrefix="ew" %>]]>
let me know if this resolves
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Manish, your article is superb. Its simply WOW. I was looking for something like this. But found something very much better. Its very nice of you that you are providing this help to all the programmers out there who need help since Microsoft completely leaves you on your own for Controls.
Thanks Again. I rate your Article 10 out of 10
Cheers Menon
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Thanks Maurice,
I know this is good piece of code but i could not get as much feedback as i expected. Hope people are using it .
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
 Zatak.dll is under Bin directory. I add "<add assembly="*"/>" to web.config.
but I'm getting error: "Could not load file or assembly eWorld.UI"
any ideas?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
You don't need to add that way.
See on toolbox, right click on that and select chhose item. Then browse and select Zatak.dll. Click on ok. Then you have zatak on that toolbox. Then just drag and drop into the page.
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
Thanks for your fast reply 
i did what you said. But this time i get the following error : "Control cannot be created because Visual Studio cannot find the control's type in the control assembly"
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
i also still get the "Build (web): Could not load file or assembly 'eWorld.UI, Version=2.0.2.2264" error.
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
When i am working Range Validation, i could not declare Designer Action property itself. but i give normal property like press F4, it is working. i could not understand this code. i added enem property. further i could not continue. if i select one validation then other validation should be false. It is my suggesstion. i will also try this.
any way it is very usful for my projects.
Raja
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
Thanks for the comment.
Raja, I could not understand first part of your description. Regarding one validation selection, it may happens that you require (RequiredFieldValidation + CompareValidator + RegExValidator) three altogether. Like Password. It is required, and compared to other password box. Also you may want to apply some proper password pattern. So it is no doubt that we can select multiple validation.
Please let me know if you have any other issue.
Manish maniish.wordpress.com
Life is not as cool as i thought of
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi Manish,
Can you give how to validate this validation in server side?
i created one property for isvalid, i could not succeed this issue
Regards Raja
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Now the error message displaying right side of the control itself. In my application i need to collect all the error messages and to be displayed in top of my application page. So i need to check all the controls validation status(whether valid or invalid)in serverside. I dont know how to capture the validation status in server side. Please help me out from this issue.
Thanking you. raj
|
| Sign In·View Thread·PermaLink | 1.00/5 |
|
|
|
 |
|
 |
Hi Raj,
See, generally we are using validation summary for doing this. But i would suggest you to derive control from valiadtion summary or look into the validation summary class what it is doing for showing that error.
Also please post if you have ne other problem so tomorrow i can help you if possible.
Thank you, maniish.wordpress.com
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
|
 |
|
|