set Page.IsValid = false;

  • Thread starter YankeeImperialistDog
  • 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
 
Y

YankeeImperialistDog

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
 
C

Cowboy \(Gregory A. Beamer\)

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.


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
 
Y

YankeeImperialistDog

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top