Using ASP NET validation controls with recaptcha

  • دعنا نشارك هذا :
ترتيب الدرس : 167
المدة : 00:05:11
التحكم :
Link for all dot net and sql server video tutorial playlists
http://www.youtube.com/user/kudvenkat/playlists

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation1

Link for slides, code samples and text version of the video
http://csharp-video-tutorials.blogspot.com/2014/10/using-aspnet-validation-controls-with.html

In this video, we will discuss using ASP.NET validation controls with recaptcha control. This is continuation to Part 166. Please watch Part 166, before proceeding.

If you have a validation summary control on the page and if the Recaptcha control has failed validation it automatically displays the error message in Validation Summary control. All you need is a validation summary control on the page where you want the error message to appear.

Include validation summary control on the page
[asp:ValidationSummary ID"ValidationSummary1" runat"server" ForeColor"Red" /]

Run the application and click the Submit Button. Notice that the error message is displayed in the validation summary control as expected.

Now let's discuss using a custom validator control with the recaptcha control. When the word verification fails we want to display a RED asterisk () next to the captcha control and the error message in validation summary control.

To achieve this
Step 1 : Include the custom validator on the page where you want the RED asterisk () to appear
[asp:CustomValidator ID"CustomValidator1" runat"server" Text"" ForeColor"Red"
OnServerValidate"RecaptchaValidator_ServerValidate"]
[/asp:CustomValidator]

Step 2 : Include the server side validation method in the code-behind file
protected void RecaptchaValidator_ServerValidate(object sender, ServerValidateEventArgs e)
{
e.IsValidthis.recaptcha.IsValid;
}

سيتم تفعيل التعليقات قريبا

y
Sep 23, 2020 07:32:27
youtube