tags:

views:

27

answers:

1

Hi, I'm currently learning ASP.NET, and read that the page validation occurs after Page.Load(). When I put if (Page.IsValid == true) whatever;

then I get an error, even though that line is in my Page_PreRender() event handler.

How does that make sense?

Thanks in advance, just trying to understand it fully.

A: 

You either have to have a control that causes validation doing the postback (CausesValidation="true") or actually call Page.Validate() manually for Page.IsValid to be accessible...otherwise validation hasn't happened, so there's just nothing to check, the value would be meaningless, which is the current error you're seeing.

Nick Craver
Oh alright, I thought it would make more sense to simply have "true" returned when nothing is validated.
Blub