Probem with hidden validators inside UpdatePanel

Last post 07-15-2007 11:48 PM by chetan.sarode. 20 replies.

Sort Posts:

  • Probem with hidden validators inside UpdatePanel

    03-20-2007, 2:18 PM
    • Loading...
    • hawflake
    • Joined on 03-20-2007, 5:30 PM
    • Chicago, IL
    • Posts 3

    Hi,

    I have a form with several validators inside an update panel. Some are hidden on page_load while others are visible. Surprisingly (despite other people's problems with validators inside UpdatePanels) those validators that are initially visible work fine. However, the hidden validators, even if they are later made visible never do anything. I looked at the generated source and found that only the initially-visible validators are ever added to the Page_Validators array. My guess is that with normal postbacks Page_Validators gets refreshed to contain all the validators on the page, whereas with an AJAX update the array does not reflect the asynchronous page changes. Any ideas on how to fix this?

    Thanks,

    Alex Rubinsteyn
     

  • Re: Probem with hidden validators inside UpdatePanel

    03-20-2007, 4:44 PM
    • Loading...
    • AjaxButter
    • Joined on 01-29-2007, 8:45 PM
    • Louisville, Colorado
    • Posts 130

    I had a similiar issue which was caused by my own stupidity.  Basically the current validators in the framework are broke as far as working with update panels until its released in a windows update.  There is a couple forums that mention where you can get a recompiled version of the validators until they are working again.  Once I added the dll and tagmappings back in everything starting working as it should.

     This post should get you more info

    http://forums.asp.net/thread/1545781.aspx

    AjaxButter

  • Re: Probem with hidden validators inside UpdatePanel

    03-20-2007, 5:26 PM
    • Loading...
    • hawflake
    • Joined on 03-20-2007, 5:30 PM
    • Chicago, IL
    • Posts 3
    It's weird that my validators (which are the VS2005 defaults, not the AJAX-friendly versions) generally work unless they were hidden when the page loaded. Anyways, I tried following the link for the modified validators and got an empty file. :-(
  • Re: Probem with hidden validators inside UpdatePanel

    03-20-2007, 6:03 PM
    • Loading...
    • AjaxButter
    • Joined on 01-29-2007, 8:45 PM
    • Louisville, Colorado
    • Posts 130

    Yeah I just tried the link and it just comes up a blank page not sure if that means they may be pushing the release very soon or if its a problem on that website.

    AjaxButter

    (I promise it does fix it though)

  • Re: Probem with hidden validators inside UpdatePanel

    03-26-2007, 2:07 PM
    • Loading...
    • AjaxButter
    • Joined on 01-29-2007, 8:45 PM
    • Louisville, Colorado
    • Posts 130

    Tried it again today looks like the link is working again

    AjaxButter

  • Re: Probem with hidden validators inside UpdatePanel

    03-30-2007, 1:51 AM
    • Loading...
    • arrdee
    • Joined on 08-23-2006, 6:08 AM
    • Posts 17

    Been getting a similar problem, but that fix you've linked to doesn't seem to fully solve the problem.

    Design: A user control with a textnox, a reqValidator and a checkbox whose checked property is linked to the validator's enable property.

    1:    In a normal non-update panel web form this works fine. When the check box is empty, no validator message is shown, as expected.

    2:    When the control was in an update panel previous to the 'fix', the validator would display correctly on initial page load. As soon as a click has been recorded no error message is shown, regardless of the checkbox / validator settings.

    3:   When within an update panel with the 'fix', the validator message is correctly displayed according to the check box settings, but it doesn't stop the postback occuring. Ie, a button will trigger the validator error message but still proceed with the button event's function.

    Are other people having similar problems? Is a full fix for this going to be available any time soon? 

  • Re: Probem with hidden validators inside UpdatePanel

    03-30-2007, 2:12 AM
    • Loading...
    • WishStar99
    • Joined on 08-05-2006, 12:11 AM
    • VietNam
    • Posts 549
    What kind of validators are you guys talking about? How about some sample here? I have validators inside an updatepanel and they work fine.
    Aeries' Coders
    Programmers' Forums at Advance Microtech


    Nothing is impossible when it comes to coding.
  • Re: Probem with hidden validators inside UpdatePanel

    04-01-2007, 9:40 PM
    • Loading...
    • arrdee
    • Joined on 08-23-2006, 6:08 AM
    • Posts 17

    On further testing my issue is specifically web part orientated. So the fix that AjaxButter linked to corrects the issue of validators within update panels, but I still experience problems with web parts, specifically those that contain validators where the web part zone is within an update panel. My problem is solved if I put the update panel within the web part zone, and the user control within that, but that means that there has the be either a seperate update panel for every web part, or one large web part with lots of user controls within it that are not distinguished as seperate.

    For an example try this scenario.

    1. Add wpm to a page
    2. add an update panel with a web part zone inside
    3. within the wpz add a user control consisting of a text box, required validator control and a button with a server linked event that updates the current time in a label or something

    • On 1st click of the btn, the label is not refreshed and the validator event fires as expected
    • Now add text to the text box, the outcome is as expected, validator not fired, label refreshed
    • Now remove the text. On button click, the validator is fired, but the button event is also fired and the label is refreshed...
    I guess my fix for the moment is to add a seperate update panel within the web part zone for every control I add. Not ideal though
  • Re: Probem with hidden validators inside UpdatePanel

    04-27-2007, 6:21 PM
    • Loading...
    • newbie06
    • Joined on 04-14-2006, 5:28 PM
    • Posts 345

    I have the following validators in my UpdatePanel: I set the UpdateMode property to Conditional.

     RegularExpressionValidator

     CompareValidatorEmail

    RequiredFieldValidator

     The first time the page is loaded everthing works fine. When I hit the clear button to clear all Textboxes and then try reentering text in the Textboxes the field validators are not firing anymore.

    Any fixes?

    newbie

  • Re: Probem with hidden validators inside UpdatePanel

    04-27-2007, 7:06 PM
    • Loading...
    • newbie06
    • Joined on 04-14-2006, 5:28 PM
    • Posts 345
  • Re: Probem with hidden validators inside UpdatePanel

    04-27-2007, 11:09 PM
    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
  • Re: Probem with hidden validators inside UpdatePanel

    04-27-2007, 11:12 PM
    Answer

    Basically in final version version of ajax Validatos are not compatable with AJAX

    http://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
  • Re: Probem with hidden validators inside UpdatePanel

    05-30-2007, 3:14 PM
    • Loading...
    • mbarlowm
    • Joined on 05-30-2007, 7:03 PM
    • Posts 3

    I have run up agaist this problem, but the tagMappings had no effect.  What's different about my project is that I'm using a deployment project to compile my User Controls (which contain the Update Panel).  I have the tag mappings in the Web.config of the compiled project, and of the project that references it.  There was no effect.  After the first AJAX postback, the validators in the UpdatePanel will not appear when appropriate violations are made.  I have no ideas about what to try next.  Does anyone have any ideas?

  • Re: Probem with hidden validators inside UpdatePanel

    05-30-2007, 3:56 PM
    • Loading...
    • Neoman
    • Joined on 04-15-2007, 10:28 PM
    • Posts 60

    From

    http://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx 


    "To make the validators compatible with an UpdatePanel control, set the EnableClientScript property of the validators to false. This disables the client script that would ordinarily be used to perform validation in the browser. As a result, during an asynchronous postback, the validators perform validation on the server. However, because only the content of the UpdatePanel is refreshed, the validators can provide the kind of immediate feedback that is ordinarily provided by client script. "

  • Re: Probem with hidden validators inside UpdatePanel

    05-30-2007, 11:41 PM

    Have you checked those link what I have provided...

    Got any solution form that ?

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
Page 1 of 2 (21 items) 1 2 Next >