set Page.IsValid = false;

  • Thread starter Thread starter YankeeImperialistDog
  • Start date Start date
Y

YankeeImperialistDog

i'm doing some custom validation and a cross page post back. i need to set
Page.IsValid = false; so i can trap it on the following page. is there a way
to do this?

i'd perfer to just cancel the crosspage post back and staying on the same
page, but don't know how to do this.

given this event

protected void lbtnRunTransaction(object sender, CommandEventArgs e)
{
if ("somevalidationroutine finds errors")
set the Page.IsValid = false
}
or better
protected void lbtnRunTransaction(object sender, CommandEventArgs e)
{
if ("somevalidationroutine finds errors")
cancel the postback;
}

KES
 
Thanks for the reply ... and me a Yankee Imperialist Dog, and you a Cowboy
makes us of a similar kind. perhaps we were derived for the abstract class
American? lol
(that was real bad geek humor and i'm no geek, but i guess we all have
geek-like days)

getting closer. I created a dummy customvalidator that i call:
blPeopleErrors.DataBind();
if (blPeopleErrors.Items.Count != 0)
{
var earg = new ServerValidateEventArgs("errors exist", false);
cvPageValidate(cvPage, earg);
return;
}
this does show up on the posted page as previouspage.isvalid == false

now i have the problem of how do i get back to the previous page. sorta the
same issue, but getting closer
 
The easiest way to handle multi-page scenarios in .NET is either by using
Panels (rolll your own ) or using the mutipage control on your form. Both
get you where you can easily hold state, as you have the state of all the
pages in viewstate. A person can go back to any "page" without really
leaving the page in question.

Outside of this, you have cache and session to deal with to store state.

The validataor controls can easily handle whether a page is valid or not,
but will not handle flow control. ;-)

Cowboy is a name given to me when I moved to Georgia and still wore a cowboy
hat. I guess it kind of stuck.

--
Gregory A. Beamer
MCP: +I, SE, SD, DBA

*********************************************
| Think outside the box!
|
*********************************************
YankeeImperialistDog said:
Thanks for the reply ... and me a Yankee Imperialist Dog, and you a Cowboy
makes us of a similar kind. perhaps we were derived for the abstract class
American? lol
(that was real bad geek humor and i'm no geek, but i guess we all have
geek-like days)

getting closer. I created a dummy customvalidator that i call:
blPeopleErrors.DataBind();
if (blPeopleErrors.Items.Count != 0)
{
var earg = new ServerValidateEventArgs("errors exist", false);
cvPageValidate(cvPage, earg);
return;
}
this does show up on the posted page as previouspage.isvalid == false

now i have the problem of how do i get back to the previous page. sorta
the
same issue, but getting closer
 
actually by using server transfer, perhaps because i'm also using ajax, i
solve the back button issue. if after transfer someone hits back, it will let
them, but all the fields are cleared.
 
Back
Top