Required field:

<asp:textbox id="textbox1" runat="server"/>
<asp:RequiredFieldValidator id="valRequired" runat="server"
ControlToValidate="textbox1" ErrorMessage="* Please enter a value" Display="dynamic">*
</asp:

how can i put the vlidation correctly

Hi, what seems to be the problem?

What the code you posted does is ...
once a buttonis clicked,
it will check if textbox1 is empty, if it is empty it will show the ErrorMessage.

If you want to validate for correct input, use RegularExpressionValidator

Hope this helps.

keyur.smith just explain your exact requirement for validation. Then we will help you better.

Dear the asp.net validation occurs on the client side for asp.net controls
The validation occurs usually on button click , you can set the button and controls intended to be validated in the same validation group
you can prevent the button click validation by set the property causes validation to false , for example the auto post back for check box or auto post back of drop down list can cause validation by set the causes validation to true of check box and drop down list asp.net controls
Now the above validation you mentioned you can extend by controls on AJAX Control Toolkit , to have a better look and feel

if problem resolved then mark this thread as resolved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.