Wednesday, March 28, 2012

postback happens even when validators show error

Hi,

I am using updatepanel in my code. I give a picture of a part of my code.

Now i have a text box with some validators on it ( required field validator and regular expression validator).

I have a save button which saves the content of the text box .

The textbox is withing the update panel and the save button is outside the update panel.

Now when a wrong iput is entered , on tab out the validator shows the error messgae but on clicking th ebutton , a post back happens. in general case where a update panel is not used the button postback event doesnt happen until the validators return true.

Could you help me on this.

Regards,

Sama

any resolution to this problem yet?

this really needs to be fixed


I also have come across this problem. I have three validators on the footer row of a gridview which is in an UpdatePanel. I use the footer for insertion of new records. When I click 'Insert', the validators fire ok and I get the red asterisks and all but it still posts back. When I take the whole thing out of the UpdatePanel it works as it's supposed to, preventing the postback if no data is entered.

I am using the latest version of Atlas.

Has anyone a solution to this and is it going to be fixed in a future ctp?

Regards,

Andy.


I just investigated further and found the following strage behaviour:

When my page first loads, the gridview is populated with data. The footer is not visible on the gridview as I set ShowFooter() to false by default. There is a button at the bottom of the page "Add Item". This posts back and sets the ShowFooter() to true so that the insert line appears. In this scenario, when the user leaves the new text fields blank, the validator fires but the page still posts back - WRONG.

If I show the footer by default when the page loads, the validators fire correctly and prevent the postback - CORRECT.

Can anyone shed any light on this, I don't want to have my insert line shown by default.

Andy.


bump...

No comments:

Post a Comment