Not long ago, when registering 9CBS, it is found that an error prompt will occur every time you leave a TextBox control.
In the previous use of ASP, it passed the "OK" button, and then verified it when submitting the page. In contrast, ASP.NET is more friendly and convenient, and it will try to try it with himself.
First, define a TextBox control,
Everyone knows that there is a verification control in .NET:
Through it, you can verify the TEXTBOX verification above the above, whether it is empty, but sometimes this feature is often not enough, so we will use the TextBox's ontextChanged and AtuopostBack.
When Atuopostback is set to "True", whenever the textbox lost the focus and text box, the events set in the onTextChanged are triggered, so we can write the verification code to the onTextChanged event, so we can implement it. Similar functions when 9CBS registration.
The entire code is as follows:
'Is the detection school entry correct
Sub StudientId_TextChanged (Sender As Object, E AS Eventargs)
DIM StudentId_Text As String
StudentId_text = studentid.text
if StudentId.Text = "" "" "
Lable1.text = "Learning number can not be empty"
Elseif Len (StudentId_text) <7 THEN
Lable1.text = "Learning number cannot be less than 7 digits"
Elseif Len (StudentId_text)> 10 THEN
Lable1.text = "Learning number cannot be greater than 10 digits"
Else
LABLE1.TEXT = "" "
END IF
End Sub
'submit Form
script>