validation control headache

N

NuB

The validation controls are giving me a headache. here is what i'm trying to
do and so far what I've tried has not worked.

I need to hide my grid if the page is not valid
how can i accomplish that?

I have one validation control that gives an error if there is no data
returned, so if the page is not valid on another search i need that to go
away. How can i hide and show controls and labels bases on the page.isvalid

has anyone done this before
 
A

Alex D.

why dont you just check for the required data in the code?
it seem that you are using the validators for a different purpose, since
your page should not be ablt to postback until all validations are
passed...unless you want to do some extra server-side validation, and then I
think you dont need the validation web controls for that.
Hope that helps.
Alex.
 
N

NuB

i'm not following;

what happens is this: I have 4 text boxes on my web form to allow a user to
do a search.
If all textboxes are populated a grid with results is populated and
displayed, then if the user
decides to do another search and misses a textbox, the required field state
is missing message is displayed, THEN if
that message is visible I then need to hide the grid from the prior
successful search.
 
A

Alex D.

I think you should read a little bit about validators...validators are not
just for displaying messages, you can use them to keep the user in the page
until all requiered fields (textboxes, radiobuttons, checkboxes, etc..) are
validated. What I was saying in the previous message is that you can just
check your textboxes for a value ex: if ( this.TextBox1.Text != "" ) {//do
something}

alex.
 
N

NuB

yes i know, I didn't create this app, I just started working on it and they
have several validators for required
 
N

NuB

yes i know, I didn't create this app, I just started working on it and they
have several validators for required fields, make sure they are the correct
length, and that some are numeric.
so i need to keep the current flow and existing code and just work with that
is already there.

so i'll research it some more
 
A

Alex D.

ok, I understand.
NuB said:
yes i know, I didn't create this app, I just started working on it and
they
have several validators for required fields, make sure they are the
correct length, and that some are numeric.
so i need to keep the current flow and existing code and just work with
that is already there.

so i'll research it some more
 
N

NuB

is there anyway to really get the grid.visible = false with using the
validationsummary controls, required field control, etc?
 
A

Alex D.

foreach (Control c in this.Page) { if (c is BaseValidator && !(c as
BaseValidator).EvaluateIsValid()) this.DataGrid1.Visible = false; }

ALEX.
 
A

Alex D.

break;


Alex D. said:
foreach (Control c in this.Page) { if (c is BaseValidator && !(c as
BaseValidator).EvaluateIsValid()) this.DataGrid1.Visible = false; }

ALEX.
 
B

bhawin13

I think there should be a way to execute validation code on server
side. So whenever you post your server side validation executed and
based on the result of validation you can show hide your grid.

Correct me if I am wrong.

B
 

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,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top