473,325 Members | 2,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Textbox validation

109 100+
Ok.. I need help again.

I have a text box in my web form, so I am trying to do is as soon as user enters anything in text box other than 1....9,0 I have to give them a message saying invalid input.

How can I check user input an give them a message?

Thank You,
Dec 7 '07 #1
5 1147
Plater
7,872 Expert 4TB
On a webform you will need to have a javascript function that watches the onkeydown() (or similar) function.
Dec 7 '07 #2
arial
109 100+
I have a asp.net webform using c#.

My textbox is:
<asp:textbox id="txtqanum" runat="server"></asp:textbox>

this one does not have a property of keypress,onblur etc.

I was thinking to compare it so asci value but ,how can compare that value entered in textbox to asci value?

like asc(txtqanum.text)

help me on this.

Thank You,
Dec 10 '07 #3
Plater
7,872 Expert 4TB
This does not work:
Expand|Select|Wrap|Line Numbers
  1. <asp:textbox id="txtqanum" onkeydown="SomeJavaScriptFunction();" runat="server"></asp:textbox>
  2.  
Dec 10 '07 #4
arial
109 100+
I don't get Onkeydown event handler.

I got the javascript function but I don't know where to call it.
Dec 10 '07 #5
Plater
7,872 Expert 4TB
It won't show up in the autocomplete.
An alternative is in the backend code, find that textbox control and do an AddAttribute() (I think that's the right name) for something like:
Expand|Select|Wrap|Line Numbers
  1. txtqanum.AddAttribute("onkeydown","SomeJavaScriptFunction();");
  2.  
Dec 10 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow...
1
by: Kum | last post by:
Hi, I need help in asp.net dynamic textbox controls validation. I am creating textbox controls dynamically on a asp.net webpage. Now after creating the textboxes on the page I want to validate...
14
by: teddysnips | last post by:
WINDOWS FORMS I've a form that has a textbox that allows the user to enter a string. On the LostFocus event, the textbox formats the string into a preferred format. However, if the user...
2
by: mrutyunjaya | last post by:
hello, i have two textbox column and one button control in gridvie when i click button it will ask plese enter price in first textbox . when enter values it is asking again. how to pass...
4
by: HenrikL | last post by:
Hi. I have a textbox that have a binding on it with converter and validationrules. When a validation error ouccur the foreground of the textbox will change to red cause it has a style.triggers...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.