Gridview textbox format validation

Posted on 2007-10-15
Last Modified: 2008-01-09
How can a textbox in a gridview be best enforced with taking in a numeric string of 7 chars no more and no less? validator control or javascript?
Question by:ksfok
    LVL 9

    Accepted Solution

    Unless you are using AJAX, I would suggest using Javascript.  I prefer the validation to be real-time, rather than on postback.  That is my preference though.  

    You should be able to do this by setting the textbox "onkeyup" property to your Javascript function.  Let me know if you have any questions about doing so.

    Hope this helps.

    Author Comment

    I have ajax installed. The gridview is currently a regular gridview. Please advsise details on how to implement javascript and AJAX way. Thanks.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    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…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video discusses moving either the default database or any database to a new volume.

    759 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

    10 Experts available now in Live!

    Get 1:1 Help Now