Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Frederik T 234 posts 345 karma points
    Apr 25, 2012 @ 15:07
    Frederik T
    0

    Quick question about usercontrols and asp.net validation controls

    Stumbled across something i cant really see where the problem is.

    So i created a dead simple contact form (hardcoded, single purpose only), that takes a few inputs from the user and sends an email. The fields are validated with plain old "RequiredFieldValidator" and others.

    When adding the usercontrol to a standard webform aspx page in my visual studio project, everything works fine, emails works, and validators work. I have taken great care to be sure everything is wired up correctly, and with proper validation groups etc.

    I then added the usercontrol to my umbraco site, the control is displayed fine but the validation does not fire and isnt shown at all.

    I dont think its necessary to show any code as there isnt much to show, its all fairly simple and straight forward.

    So anyone stumbled across the same problems?

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Apr 25, 2012 @ 15:26
    Tom Fulton
    0

    Hi,

    Is the validation not firing but the email is sending, or is the button click doing nothing at all?

    If it's not doing anything, make sure you are wrapping the usercontrol in a <form runat="server"> in your template.

    -Tom

  • Frederik T 234 posts 345 karma points
    Apr 25, 2012 @ 17:54
    Frederik T
    0

    Thank you for your reply.

    Ok got around testing it again. If i type in the correct data and submit it, it does send an email exactly like it should (this is tested in the live production environment).

    If i do it wrong, nothing gets sent. So it seems like the validation works, but it doesnt display anything (the browser also scrolls to the top whenever i click the submit button but it doesnt look like a postback because there is a video running on the same page and it doesnt reload when it happens).

  • Frederik T 234 posts 345 karma points
    Apr 27, 2012 @ 23:37
    Frederik T
    0

    I searched around the forums some more, and seems i am not the only one with this problem. The thing is, there is not a solution in any of the forum posts, and those that resembled one, did not work.

    This is just so odd.

  • Frederik T 234 posts 345 karma points
    Aug 20, 2012 @ 12:49
    Frederik T
    2

    yeah it has been a while but i found the culprit, sort of. Just writing it here so it will maybe help anyone who stumbles by from google and what not.

    Anyway, the site i was working on, where the asp.net validation didnt work, was because of modernizr. The website is built on the Foundation framework by Zurb, and they include a modernizr script, which is somehow blocking the asp.net validators from being displayed. After i commented out the script on the page where the usercontrol was being used, everything worked fine.

    So what exactly is causing the problem, i do not know, but its a start.

  • Gerty Engrie 130 posts 489 karma points c-trib
    Aug 17, 2015 @ 22:14
    Gerty Engrie
    0

    If I could add a 1000 high fives I would, thanks a lot! Been searching on this one for hours.

Please Sign in or register to post replies

Write your reply to:

Draft